mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-03 01:33:19 +00:00
Add simple test cases
This commit is contained in:
parent
1113118c06
commit
723345b21a
1 changed files with 32 additions and 2 deletions
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
TEST_CASE("Creating task from string")
|
TEST_CASE("Creating task from string")
|
||||||
{
|
{
|
||||||
SECTION("Task with all properties")
|
SECTION("All properties")
|
||||||
{
|
{
|
||||||
auto task = mirai::TodoMdFormat::StringToTask(
|
auto task = mirai::TodoMdFormat::StringToTask(
|
||||||
"- [X] 08:00-10:00 > This is a test -- #mirai", "2024-04-19"
|
"- [X] 08:00-10:00 > This is a test -- #mirai", "2024-04-19"
|
||||||
|
@ -27,7 +27,7 @@ TEST_CASE("Creating task from string")
|
||||||
REQUIRE(task.endTime == "10:00");
|
REQUIRE(task.endTime == "10:00");
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Task with all properties 2")
|
SECTION("All properties 2")
|
||||||
{
|
{
|
||||||
auto task = mirai::TodoMdFormat::StringToTask(
|
auto task = mirai::TodoMdFormat::StringToTask(
|
||||||
"- [ ] 09:00-17:00 > This is another test -- #mirai #feature", "2024-04-20"
|
"- [ ] 09:00-17:00 > This is another test -- #mirai #feature", "2024-04-20"
|
||||||
|
@ -41,4 +41,34 @@ TEST_CASE("Creating task from string")
|
||||||
REQUIRE(task.startTime == "09:00");
|
REQUIRE(task.startTime == "09:00");
|
||||||
REQUIRE(task.endTime == "17:00");
|
REQUIRE(task.endTime == "17:00");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("Only text")
|
||||||
|
{
|
||||||
|
auto task = mirai::TodoMdFormat::StringToTask("- [ ] This is another test", "");
|
||||||
|
REQUIRE(task.date == "");
|
||||||
|
REQUIRE(task.tags.size() == 0);
|
||||||
|
REQUIRE(task.text == "This is another test");
|
||||||
|
REQUIRE(task.state == mirai::TODO);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("Only text with a date")
|
||||||
|
{
|
||||||
|
auto task = mirai::TodoMdFormat::StringToTask("- [X] This is another test", "2025-02-03");
|
||||||
|
REQUIRE(task.date == "2025-02-03");
|
||||||
|
REQUIRE(task.tags.size() == 0);
|
||||||
|
REQUIRE(task.text == "This is another test");
|
||||||
|
REQUIRE(task.state == mirai::DONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("Tags before -- are not tags")
|
||||||
|
{
|
||||||
|
auto task = mirai::TodoMdFormat::StringToTask(
|
||||||
|
"- [ ] This is another test #ImNotATag -- #ImATag", ""
|
||||||
|
);
|
||||||
|
REQUIRE(task.date == "");
|
||||||
|
REQUIRE(task.tags.size() == 1);
|
||||||
|
REQUIRE(task.tags[0] == "ImATag");
|
||||||
|
REQUIRE(task.text == "This is another test #ImNotATag");
|
||||||
|
REQUIRE(task.state == mirai::TODO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue