diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-26 17:33:24 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-26 17:33:24 +0200 |
commit | 61d9e8699687342c2e32c32c8d4eb71760d5d290 (patch) | |
tree | 9fd6ce694d857704ad369ac32f779c19ab4f665d /tests | |
parent | 3a150e29cd1fa63614f45dff01240b01f9c4a025 (diff) |
Use fork/exec instead of popen. Add Path class
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/confTest/confTest.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/src/confTest/confTest.cpp b/tests/src/confTest/confTest.cpp index 68e2225..c770266 100644 --- a/tests/src/confTest/confTest.cpp +++ b/tests/src/confTest/confTest.cpp @@ -3,6 +3,16 @@ using namespace sibs; +static FileString arg_list_to_string(const std::vector<FileString> &args) { + FileString result; + for(const FileString &arg : args) { + if(!result.empty()) + result += TINYDIR_STRING(" "); + result += TINYDIR_STRING("\"") + arg + TINYDIR_STRING("\""); + } + return result; +} + TEST_CASE("parse config") { SibsConfig sibsConfig(Compiler::GCC, TINYDIR_STRING("tests/src/confTest"), OPT_LEV_DEBUG, false); @@ -20,28 +30,28 @@ TEST_CASE("parse config") REQUIRE(containsPlatform(sibsConfig.getPlatforms(), PLATFORM_WIN64)); REQUIRE(sibsConfig.getPackageListDependencies().size() == 2); - for(auto *dep : sibsConfig.getPackageListDependencies()) + for(const auto &dep : sibsConfig.getPackageListDependencies()) { - REQUIRE(dep->getSource() == Dependency::Source::PACKAGE_LIST); + REQUIRE(dep.getSource() == Dependency::Source::PACKAGE_LIST); } - auto *xxhashDependency = sibsConfig.getPackageListDependencies()[0]->asPackageListDependency(); + auto *xxhashDependency = sibsConfig.getPackageListDependencies()[0].asPackageListDependency(); REQUIRE(xxhashDependency->name == "xxhash"); REQUIRE(xxhashDependency->version.toString() == ">=0.1.0 and <1.0.0"); - const auto &catch2Dependency = sibsConfig.getPackageListDependencies()[1]->asPackageListDependency(); + const auto &catch2Dependency = sibsConfig.getPackageListDependencies()[1].asPackageListDependency(); REQUIRE(catch2Dependency->name == "catch2"); REQUIRE(catch2Dependency->version.toString() == ">=1.0.0 and <2.0.0"); REQUIRE(sibsConfig.shouldUseCmake()); REQUIRE(sibsConfig.getCmakeDir() == TINYDIR_STRING("tests/src/confTest/cmakeGlobal")); - REQUIRE(sibsConfig.getCmakeArgs() == "-G Ninja \"-DCMAKE_BUILD_TYPE=Debug\" \"-DENTITYX_RUN_BENCHMARKS=0\""); + REQUIRE(arg_list_to_string(sibsConfig.getCmakeArgs()) == "\"-G\" \"Ninja\" \"-DCMAKE_BUILD_TYPE=Debug\" \"-DENTITYX_RUN_BENCHMARKS=0\""); REQUIRE(sibsConfig.getCmakeDirStatic() == TINYDIR_STRING("tests/src/confTest/cmakeStatic")); - REQUIRE(sibsConfig.getCmakeArgsStatic() == "-G Ninja \"-DCMAKE_BUILD_TYPE=Debug\" \"-DENTITYX_RUN_BENCHMARKS=0\" \"-DENTITYX_BUILD_TESTING=0\""); + REQUIRE(arg_list_to_string(sibsConfig.getCmakeArgsStatic()) == "\"-G\" \"Ninja\" \"-DCMAKE_BUILD_TYPE=Debug\" \"-DENTITYX_RUN_BENCHMARKS=0\" \"-DENTITYX_BUILD_TESTING=0\""); REQUIRE(sibsConfig.getCmakeDirDynamic() == TINYDIR_STRING("tests/src/confTest/cmakeDynamic")); - REQUIRE(sibsConfig.getCmakeArgsDynamic() == "-G Ninja \"-DCMAKE_BUILD_TYPE=Debug\" \"-DENTITYX_RUN_BENCHMARKS=0\" \"-DENTITYX_BUILD_TESTING=0\" \"-DENTITYX_BUILD_SHARED=1\""); + REQUIRE(arg_list_to_string(sibsConfig.getCmakeArgsDynamic()) == "\"-G\" \"Ninja\" \"-DCMAKE_BUILD_TYPE=Debug\" \"-DENTITYX_RUN_BENCHMARKS=0\" \"-DENTITYX_BUILD_TESTING=0\" \"-DENTITYX_BUILD_SHARED=1\""); } TEST_CASE("parse config - invalid object") |