Skip to content

Commit

Permalink
Correct error and unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
loganharbour committed Nov 30, 2024
1 parent 62b2473 commit d5f5a67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion framework/src/base/Registry.C
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Registry::addDataFilePath(const std::string & name, const std::string & in_tree_

// Enforce that the folder is called "data", because we rely on the installed path
// to be within PREFIX/share/<name>/data (see determineDataFilePath())
const auto folder = MooseUtils::shortName(in_tree_path);
const std::string folder = std::filesystem::path(in_tree_path).filename().c_str();
if (folder != "data")
mooseError("While registering data file path '",
in_tree_path,
Expand Down
8 changes: 4 additions & 4 deletions unit/src/RegistryTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ TEST_F(RegistryTest, appNameFromAppPathFailed)
TEST_F(RegistryTest, addDataFilePathNonDataFolder)
{
const std::string name = "non_data_folder";
const std::string path = "foo";
const std::string abs_path = MooseUtils::absolutePath(path);
const std::string path = "files/data_file_tests/data0";
const std::string folder = std::filesystem::path(path).filename().c_str();

EXPECT_THROW(
{
Expand All @@ -92,8 +92,8 @@ TEST_F(RegistryTest, addDataFilePathNonDataFolder)
catch (const std::exception & e)
{
EXPECT_EQ(std::string(e.what()),
"While registering data file path '" + abs_path + "' for '" + name +
"': The folder must be named 'data' and it is named '" + path + "'");
"While registering data file path '" + path + "' for '" + name +
"': The folder must be named 'data' and it is named '" + folder + "'");
throw;
}
},
Expand Down

0 comments on commit d5f5a67

Please sign in to comment.