diff options
Diffstat (limited to 'test-ymake.cpp')
-rw-r--r-- | test-ymake.cpp | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/test-ymake.cpp b/test-ymake.cpp index dfed871..1df3ce0 100644 --- a/test-ymake.cpp +++ b/test-ymake.cpp @@ -187,14 +187,32 @@ TEST_F(ymakeTest, build_three_cpp) </ymake> )"); + EXPECT_TRUE(!fs::exists("hello.o")); + EXPECT_TRUE(!fs::exists("second.o")); + EXPECT_TRUE(!fs::exists("third.o")); + EXPECT_TRUE(!fs::exists("hello")); + std::vector<std::string> output; int result = run_command("../ymake", output); EXPECT_EQ(result, 0); EXPECT_EQ(output.size(), 4); // compile 3, link 1 + + EXPECT_TRUE(fs::exists("hello.o")); + EXPECT_TRUE(fs::exists("second.o")); + EXPECT_TRUE(fs::exists("third.o")); + EXPECT_TRUE(fs::exists("hello")); + + result = run_command("../ymake clean"); + EXPECT_EQ(result, 0); + + EXPECT_TRUE(!fs::exists("hello.o")); + EXPECT_TRUE(!fs::exists("second.o")); + EXPECT_TRUE(!fs::exists("third.o")); + EXPECT_TRUE(!fs::exists("hello")); } -// TODO: test .c .cc .cpp +// TODO: test file extensions .c .cc .cpp // TODO: multiple builds // TODO: test tests // TODO: test g++/clang++ @@ -234,7 +252,32 @@ TEST_F(yscanTest, one_cpp_file) )"); } -// TODO: test multiple files +TEST_F(yscanTest, one_three_files) +{ + create_file("hello.cpp", R"(int main(int argc, char* argv[]) +{ + return 0; +})"); + create_file("second.cpp", R"()"); + create_file("third.cpp", R"()"); + create_file("fourth.cpp", R"()"); + + std::string output; + int result = run_command("../yscan", output); + EXPECT_EQ(result, 0); + + EXPECT_EQ(output, R"(<ymake> + <build> + <name>testdir1</name> + <source>fourth.cpp</source> + <source>hello.cpp</source> + <source>second.cpp</source> + <source>third.cpp</source> + </build> +</ymake> +)"); +} + // TODO: test multiple builds // TODO: test tests |