Skip to content

Commit

Permalink
unittests: added missing full path use cases
Browse files Browse the repository at this point in the history
  • Loading branch information
alaaeddineelamri committed May 28, 2021
1 parent f26ef89 commit 51b6e01
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions core/src/tests/globbing_test.cc
Expand Up @@ -156,8 +156,29 @@ TEST(globbing, globbing_in_markcmd)

PopulateTree(files, &tree);

// testing full paths
FakeCdCmd(&ua, &tree, "/");
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "*"), files.size());

EXPECT_EQ(
FakeMarkCmd(&ua, &tree, "/testingwildcards/lonesubdirectory/whatever"),
1);

EXPECT_EQ(
FakeMarkCmd(&ua, &tree, "testingwildcards/lonesubdirectory/whatever"), 1);

// Using full path while being in a different folder than root
FakeCdCmd(&ua, &tree, "/some/weirdfiles/");
EXPECT_EQ(
FakeMarkCmd(&ua, &tree, "/testingwildcards/lonesubdirectory/whatever"),
1);
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "/testingwildcards/sub*"), 6);

EXPECT_EQ(
FakeMarkCmd(&ua, &tree, "testingwildcards/lonesubdirectory/whatever"), 0);

// Testing patterns in different folders
FakeCdCmd(&ua, &tree, "/some/weirdfiles/");
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "nope"), 0);
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "potato"), 1);
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "potato*"), 2);
Expand All @@ -171,9 +192,6 @@ TEST(globbing, globbing_in_markcmd)
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "wei*/subroza/*"), 0);
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "w*efiles/sub*/*"), 6);

FakeCdCmd(&ua, &tree, "/");
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "*"), files.size());

FakeCdCmd(&ua, &tree, "/testingwildcards/");
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "p?tato"), 1);
EXPECT_EQ(FakeMarkCmd(&ua, &tree, "subdirectory?/file1"), 1);
Expand Down

0 comments on commit 51b6e01

Please sign in to comment.