Skip to content

Commit

Permalink
In parser config test, use a filename less likely to exist (#1362)
Browse files Browse the repository at this point in the history
* In parser config test, use a filename less likely to exist

The file /usr/share/empty is not unique enough to guarantee that it does
not exist, and the test seems to require that there be no file or
directory with that name.

On Fedora, the file /usr/share/empty is present on every single system.

---------

Signed-off-by: Scott K Logan <[email protected]>
  • Loading branch information
cottsay authored Jan 30, 2024
1 parent e7d7cef commit 191e58b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/integration/parser_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ TEST(ParserConfig, GlobalConfig)

ASSERT_TRUE(sdf::ParserConfig::GlobalConfig().FindFileCallback());
EXPECT_EQ("test/dir2",
sdf::ParserConfig::GlobalConfig().FindFileCallback()("empty"));
sdf::ParserConfig::GlobalConfig().FindFileCallback()("should_not_exist"));
// sdf::findFile requires explicitly enabling callbacks
EXPECT_EQ("test/dir2", sdf::findFile("empty", false, true));
EXPECT_EQ("test/dir2", sdf::findFile("empty", true, true));
EXPECT_EQ("test/dir2", sdf::findFile("should_not_exist", false, true));
EXPECT_EQ("test/dir2", sdf::findFile("should_not_exist", true, true));
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -81,9 +81,10 @@ TEST(ParserConfig, NonGlobalConfig)
EXPECT_EQ(it->second.front(), testDir);

ASSERT_TRUE(config.FindFileCallback());
EXPECT_EQ("test/dir2", config.FindFileCallback()("empty"));
EXPECT_EQ("test/dir2", sdf::findFile("empty", false, true, config));
EXPECT_EQ("test/dir2", sdf::findFile("empty", true, true, config));
EXPECT_EQ("test/dir2", config.FindFileCallback()("should_not_exist"));
EXPECT_EQ("test/dir2",
sdf::findFile("should_not_exist", false, true, config));
EXPECT_EQ("test/dir2", sdf::findFile("should_not_exist", true, true, config));

EXPECT_TRUE(sdf::ParserConfig::GlobalConfig().URIPathMap().empty());
EXPECT_FALSE(sdf::ParserConfig::GlobalConfig().FindFileCallback());
Expand Down

0 comments on commit 191e58b

Please sign in to comment.