diff options
Diffstat (limited to 'test-ymake.cpp')
-rw-r--r-- | test-ymake.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test-ymake.cpp b/test-ymake.cpp index 886a43b..9d6cd43 100644 --- a/test-ymake.cpp +++ b/test-ymake.cpp @@ -937,6 +937,44 @@ extern int hello(); EXPECT_TRUE(!fs::exists("runmain")); } +TEST_F(ymakeTest, use_one_external_lib) +{ + create_file("YMakefile", R"( +<ymake> + <build> + <name>runmain</name> + <source>runmain.cpp</source> + <linklib>fmt</linklib> + </build> +</ymake> +)"); + + create_file("runmain.cpp", R"( +int main(int argc, char* argv[]) +{ + return 0; +})"); + + std::vector<std::string> output; + int result = run_command("../ymake", output); + EXPECT_EQ(result, 0); + ASSERT_EQ(output.size(), 2); // compile, link, compile, link + + EXPECT_TRUE(fs::exists("runmain.o")); + EXPECT_TRUE(fs::exists("runmain")); + + result = run_command("./runmain", output); + EXPECT_EQ(result, 0); + ASSERT_EQ(output.size(), 0); + + result = run_command("../ymake clean", output); + EXPECT_EQ(result, 0); + ASSERT_EQ(output.size(), 3); // runmain.o, runmain.d, runmain + + EXPECT_TRUE(!fs::exists("runmain.o")); + EXPECT_TRUE(!fs::exists("runmain")); +} + TEST_F(ymakeTest, use_one_dynamic_lib) { create_file("YMakefile", R"( |