Index: tools/gn/ninja_binary_target_writer_unittest.cc |
diff --git a/tools/gn/ninja_binary_target_writer_unittest.cc b/tools/gn/ninja_binary_target_writer_unittest.cc |
index 2ad816ac14b2e893da9450d30442809885c3ae2c..5438c4dc6bd463db230cf98c94ad79bfb30fa81c 100644 |
--- a/tools/gn/ninja_binary_target_writer_unittest.cc |
+++ b/tools/gn/ninja_binary_target_writer_unittest.cc |
@@ -6,6 +6,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "tools/gn/ninja_binary_target_writer.h" |
+#include "tools/gn/scheduler.h" |
#include "tools/gn/target.h" |
#include "tools/gn/test_with_scope.h" |
@@ -459,3 +460,23 @@ TEST(NinjaBinaryTargetWriter, WinPrecompiledHeaders) { |
EXPECT_EQ(pch_win_expected, out.str()); |
} |
} |
+ |
+// Should throw an error with the scheduler if a duplicate object file exists. |
+// This is dependent on the toolchain's object file mapping. |
+TEST(NinjaBinaryTargetWriter, DupeObjFileError) { |
+ Scheduler scheduler; |
+ |
+ TestWithScope setup; |
+ TestTarget target(setup, "//foo:bar", Target::EXECUTABLE); |
+ target.sources().push_back(SourceFile("//a.cc")); |
+ target.sources().push_back(SourceFile("//a.cc")); |
+ |
+ EXPECT_FALSE(scheduler.is_failed()); |
+ |
+ std::ostringstream out; |
+ NinjaBinaryTargetWriter writer(&target, out); |
+ writer.Run(); |
+ |
+ // Should have issued an error. |
+ EXPECT_TRUE(scheduler.is_failed()); |
+} |