diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2026-01-27 08:36:20 +0100 |
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2026-01-27 08:36:20 +0100 |
| commit | 282f90f717d93267b2bc64d8bfa4e3e2b7c21711 (patch) | |
| tree | 0ce29a525b8d25e8635bc2ae2e7d32342285eb20 | |
| parent | 175026ba3681bc341ae7e6f322061048a6ac1c46 (diff) | |
Some small changes to the testsdevelop
| -rw-r--r-- | test/ctor.cc | 1 | ||||
| -rw-r--r-- | test/execute_test.cc | 19 | ||||
| -rw-r--r-- | test/source_type_test.cc | 8 |
3 files changed, 23 insertions, 5 deletions
diff --git a/test/ctor.cc b/test/ctor.cc index 053e4e6..e7ed038 100644 --- a/test/ctor.cc +++ b/test/ctor.cc @@ -234,6 +234,7 @@ ctor::build_configurations ctorTestConfigs(const ctor::settings& settings) "../src/tools.cc", "../src/util.cc", "../src/externals_manual.cc", + "../configuration.cc", }, .flags = { .cxxflags = { diff --git a/test/execute_test.cc b/test/execute_test.cc index 11b067f..f8f902f 100644 --- a/test/execute_test.cc +++ b/test/execute_test.cc @@ -23,6 +23,8 @@ public: void return_value() { + constexpr int segfault_return_value = 11; + constexpr int exception_return_value = 6; ctor::settings s; auto cur_path = std::filesystem::path(paths::argv_0).parent_path(); std::vector<std::string> paths{{cur_path.string()}}; @@ -31,16 +33,21 @@ public: auto value = execute(s, cmd, {"retval", "0"}, {}, false); uASSERT_EQUAL(0, value); + value = execute(s, cmd, {"retval", "1"}, {}, false); uASSERT_EQUAL(1, value); + value = execute(s, "no-such-binary", {}, {}, false); uASSERT_EQUAL(1, value); + value = execute(s, cmd, {"segfault"}, {}, false); - uASSERT_EQUAL(11, value); + uASSERT_EQUAL(segfault_return_value, value); + value = execute(s, cmd, {"throw"}, {}, false); - uASSERT_EQUAL(6, value); + uASSERT_EQUAL(exception_return_value, value); + value = execute(s, cmd, {"abort"}, {}, false); - uASSERT_EQUAL(6, value); + uASSERT_EQUAL(exception_return_value, value); } void env() @@ -83,11 +90,13 @@ public: chk = std::find(vars.begin(), vars.end(), "bar=42"s); uASSERT(chk != vars.end()); - // Check the one that should have overwritten the existing one (probably LANG=en_US.UTF-8 or something) + // Check the one that should have overwritten the existing one (probably + // LANG=en_US.UTF-8 or something) chk = std::find(vars.begin(), vars.end(), "LANG=foo"s); uASSERT(chk != vars.end()); - // Check that other vars are also there (ie. the env wasn't cleared on entry) + // Check that other vars are also there (ie. the env wasn't cleared on + // entry) uASSERT(vars.size() > 3); } }; diff --git a/test/source_type_test.cc b/test/source_type_test.cc index 288f1e5..657260e 100644 --- a/test/source_type_test.cc +++ b/test/source_type_test.cc @@ -26,6 +26,14 @@ std::ostream& operator<<(std::ostream& stream, const ctor::language& lang) return stream; } +const ctor::configuration& ctor::get_configuration() +{ + static ctor::configuration cfg{}; + cfg.build_toolchain = ctor::toolchain::gcc; + cfg.build_arch = ctor::arch::unix; + return cfg; +} + class TestableTaskCC : public TaskCC { |
