summaryrefslogtreecommitdiff
path: root/test/generated_sources_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/generated_sources_test.cc')
-rw-r--r--test/generated_sources_test.cc55
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'