shared_compile_file_rules() = default; | shared_compile_file_rules() = default; | ||||
auto clone() const noexcept { | auto clone() const noexcept { | ||||
auto cp = *this; | |||||
auto cp = *this; | |||||
cp._impl = std::make_shared<rules_impl>(*_impl); | cp._impl = std::make_shared<rules_impl>(*_impl); | ||||
return cp; | return cp; | ||||
} | } |
extern const char* const catch2_embedded_single_header_str; | extern const char* const catch2_embedded_single_header_str; | ||||
} // namespace dds::detail | |||||
} // namespace dds::detail |
} else if (test_driver_str == "Catch") { | } else if (test_driver_str == "Catch") { | ||||
ret.test_driver = test_lib::catch_; | ret.test_driver = test_lib::catch_; | ||||
} else { | } else { | ||||
throw std::runtime_error( | |||||
fmt::format("Unknown 'Test-Driver': '{}'", test_driver_str)); | |||||
throw std::runtime_error(fmt::format("Unknown 'Test-Driver': '{}'", test_driver_str)); | |||||
} | } | ||||
} | } | ||||
#include <dds/sdist.hpp> | #include <dds/sdist.hpp> | ||||
#include <dds/temp.hpp> | #include <dds/temp.hpp> | ||||
#include <semver/version.hpp> | |||||
#include <libman/library.hpp> | #include <libman/library.hpp> | ||||
#include <semver/version.hpp> | |||||
#include <set> | #include <set> | ||||
#include <string> | #include <string> |
fs::path repository::default_local_path() noexcept { return dds_data_dir() / "repo"; } | fs::path repository::default_local_path() noexcept { return dds_data_dir() / "repo"; } | ||||
repository repository::_open_for_directory(bool writeable, path_ref dirpath) { | repository repository::_open_for_directory(bool writeable, path_ref dirpath) { | ||||
sdist_set entries = load_sdists(dirpath) | to<sdist_set>(); | |||||
sdist_set entries = load_sdists(dirpath) | to<sdist_set>(); | |||||
return {writeable, dirpath, std::move(entries)}; | return {writeable, dirpath, std::move(entries)}; | ||||
} | } | ||||
}; | }; | ||||
struct sdist { | struct sdist { | ||||
package_manifest manifest; | |||||
fs::path path; | |||||
package_manifest manifest; | |||||
fs::path path; | |||||
sdist(package_manifest man, path_ref path_) | sdist(package_manifest man, path_ref path_) | ||||
: manifest(std::move(man)) | : manifest(std::move(man)) |
ret = {get_compiler(language::cxx), "/nologo", "/EHsc", "<IN>", "/Fe<OUT>"}; | ret = {get_compiler(language::cxx), "/nologo", "/EHsc", "<IN>", "/Fe<OUT>"}; | ||||
} else if (is_gnu_like) { | } else if (is_gnu_like) { | ||||
ret = {get_compiler(language::cxx), | ret = {get_compiler(language::cxx), | ||||
"-fPIC", | |||||
"-fdiagnostics-color", | |||||
"<IN>", | |||||
"-pthread", | |||||
"-lstdc++fs", | |||||
"-o<OUT>"}; | |||||
"-fPIC", | |||||
"-fdiagnostics-color", | |||||
"<IN>", | |||||
"-pthread", | |||||
"-lstdc++fs", | |||||
"-o<OUT>"}; | |||||
} else { | } else { | ||||
assert(false && "No link-exe command"); | assert(false && "No link-exe command"); | ||||
std::terminate(); | std::terminate(); |
std::string_view expected_compile_warnings, | std::string_view expected_compile_warnings, | ||||
std::string_view expected_ar, | std::string_view expected_ar, | ||||
std::string_view expected_exe) { | std::string_view expected_exe) { | ||||
auto tc = dds::parse_toolchain_dds(tc_content); | |||||
auto tc = dds::parse_toolchain_dds(tc_content); | |||||
dds::compile_file_spec cf; | dds::compile_file_spec cf; | ||||
cf.source_path = "foo.cpp"; | cf.source_path = "foo.cpp"; |
#define CHECK_SHLEX(str, ...) \ | #define CHECK_SHLEX(str, ...) \ | ||||
do { \ | do { \ | ||||
INFO("Shell-lexing string: '" << str << "'"); CHECK(dds::split_shell_string(str) == std::vector<std::string>(__VA_ARGS__)); \ | |||||
INFO("Shell-lexing string: '" << str << "'"); \ | |||||
CHECK(dds::split_shell_string(str) == std::vector<std::string>(__VA_ARGS__)); \ | |||||
} while (0) | } while (0) | ||||
TEST_CASE("Shell lexer") { | TEST_CASE("Shell lexer") { |
CHECK(!ends_with("foo.bar", "foo")); | CHECK(!ends_with("foo.bar", "foo")); | ||||
} | } | ||||
TEST_CASE( "trim" ) { | |||||
TEST_CASE("trim") { | |||||
CHECK(trim_view("foo") == "foo"); | CHECK(trim_view("foo") == "foo"); | ||||
CHECK(trim_view("foo ") == "foo"); | CHECK(trim_view("foo ") == "foo"); | ||||
CHECK(trim_view(" ").size() == 0); | CHECK(trim_view(" ").size() == 0); | ||||
} | } | ||||
TEST_CASE( "contains" ) { | |||||
TEST_CASE("contains") { | |||||
CHECK(contains("foo", "foo")); | CHECK(contains("foo", "foo")); | ||||
CHECK(contains("foo", "")); | CHECK(contains("foo", "")); | ||||
CHECK(contains("foo", "o")); | CHECK(contains("foo", "o")); | ||||
CHECK(!contains("foo", "bar")); | CHECK(!contains("foo", "bar")); | ||||
} | } | ||||
TEST_CASE( "split" ) { | |||||
TEST_CASE("split") { | |||||
CHECK_SPLIT("foo.bar", ".", {"foo", "bar"}); | CHECK_SPLIT("foo.bar", ".", {"foo", "bar"}); | ||||
CHECK_SPLIT("foo.bar.baz", ".", {"foo", "bar", "baz"}); | CHECK_SPLIT("foo.bar.baz", ".", {"foo", "bar", "baz"}); | ||||
CHECK_SPLIT(".", ".", {"", ""}); | CHECK_SPLIT(".", ".", {"", ""}); |