Skip to content

Commit

Permalink
tests: allow cwd to be main dir too
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored and calebzulawski committed May 1, 2024
1 parent 39a60e7 commit a8a4090
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 15 deletions.
2 changes: 0 additions & 2 deletions tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ cc_test(
"ensure_utf8_twice",
],
local_defines = [
"BAZEL",
'CLI11_ENSURE_UTF8_EXE=\\"$(rootpath ensure_utf8)\\"',
'CLI11_ENSURE_UTF8_TWICE_EXE=\\"$(rootpath ensure_utf8_twice)\\"',
],
Expand All @@ -47,7 +46,6 @@ cc_test(
test + ".cpp",
"app_helper.hpp",
],
local_defines = ["BAZEL"],
deps = [
"catch_main",
"//:cli11",
Expand Down
3 changes: 2 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ file(
GLOB_RECURSE DATA_FILES
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/data/*")
"${CMAKE_CURRENT_SOURCE_DIR}/data/*"
"${CMAKE_CURRENT_SOURCE_DIR}/tests/.gitkeep")

foreach(DATA_FILE IN LISTS DATA_FILES)
add_custom_command(
Expand Down
12 changes: 0 additions & 12 deletions tests/HelpersTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,7 @@ TEST_CASE("Validators: FileIsDir", "[helpers]") {
}

TEST_CASE("Validators: DirectoryExists", "[helpers]") {
#ifdef BAZEL
std::string mydir{"tests"};
#else
std::string mydir{"../tests"};
#endif
CHECK(CLI::ExistingDirectory(mydir).empty());
}

Expand All @@ -547,11 +543,7 @@ TEST_CASE("Validators: DirectoryIsFile", "[helpers]") {
}

TEST_CASE("Validators: PathExistsDir", "[helpers]") {
#ifdef BAZEL
std::string mydir{"tests"};
#else
std::string mydir{"../tests"};
#endif
CHECK(CLI::ExistingPath(mydir).empty());
}

Expand Down Expand Up @@ -673,11 +665,7 @@ TEST_CASE("Validators: CombinedPaths", "[helpers]") {
bool ok = static_cast<bool>(std::ofstream(myfile.c_str()).put('a')); // create file
CHECK(ok);

#ifdef BAZEL
std::string dir{"tests"};
#else
std::string dir{"../tests"};
#endif
std::string notpath{"nondirectory"};

auto path_or_dir = CLI::ExistingPath | CLI::ExistingDirectory;
Expand Down
Empty file added tests/tests/.gitkeep
Empty file.

0 comments on commit a8a4090

Please sign in to comment.