diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-12-27 15:08:07 +0100 |
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2026-01-05 22:47:12 +0100 |
| commit | fa99825fa800f0faf4a6e6b1d639b261c7aa43c9 (patch) | |
| tree | 17945e16aa7f33c8aede1694c90a08b7cc05e0e1 /test/generated_sources_test.cc | |
| parent | 5ac072c0f42bf3216d16f177c795e9324bf3c52b (diff) | |
Add many-to-one generator function type.develop
Diffstat (limited to 'test/generated_sources_test.cc')
| -rw-r--r-- | test/generated_sources_test.cc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/generated_sources_test.cc b/test/generated_sources_test.cc index 1ea7538..8c46983 100644 --- a/test/generated_sources_test.cc +++ b/test/generated_sources_test.cc @@ -14,6 +14,7 @@ public: GeneratedSourcesTest() { uTEST(GeneratedSourcesTest::test_custom_output); + uTEST(GeneratedSourcesTest::test_many_to_one_output); } void setup() @@ -74,6 +75,60 @@ public: } uASSERT(found); } + + void test_many_to_one_output() + { + using namespace std::string_literals; + + ctor::reg( + [](const ctor::settings&) + { + return ctor::build_configurations{ + { + .target = "test1", + .sources = { + {"foo.cc", ctor::source_type::generated} + } + }, + { + .target = "foo.cc", + .sources = { + {"bar.x"}, + {"bar.y"}, + }, + .function = [](const std::vector<std::string>& input, + const std::string& output, + const ctor::build_configuration& config, + const ctor::settings& settings) + { + return 0; + } + }, + }; + }); + ctor::settings settings{}; + auto tasks = getTasks(settings); + for(auto task : tasks) + { + uASSERT(task->registerDepTasks(tasks) == 0); + } + uASSERT_EQUAL(4u, tasks.size()); + bool found{false}; + for(const auto& task : tasks) + { + if(task->target() == "test1") + { + auto deps_test1 = task->getDependsTasks(); + uASSERT_EQUAL(1u, deps_test1.size()); + auto deps_foo_o = deps_test1[0]->getDependsTasks(); + uASSERT_EQUAL(1u, deps_foo_o.size()); + uASSERT_EQUAL("test/bar.x"s, deps_foo_o[0]->source()); + found = true; + } + } + uASSERT(found); + } + }; // Registers the fixture into the 'registry' |
