From d9e360bb95d4fced4974bb716f993c81626417cb Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 11 Jun 2024 17:15:19 +0200 Subject: bugfix: external lib linking --- test-ymake.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test-ymake.cpp') 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"( + + + runmain + runmain.cpp + fmt + + +)"); + + create_file("runmain.cpp", R"( +int main(int argc, char* argv[]) +{ + return 0; +})"); + + std::vector 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"( -- cgit v1.2.3