| 21 | }; |
| 22 | |
| 23 | TEST_F(UvRunnerTest, RunUvVersion) { |
| 24 | UvRunner runner; |
| 25 | |
| 26 | std::string output; |
| 27 | bool completed = false; |
| 28 | bool success = false; |
| 29 | int exit_code = -1; |
| 30 | |
| 31 | runner.set_output_callback([&](const std::string& line, bool is_error, bool is_line_update) { |
| 32 | output += line + "\n"; |
| 33 | }); |
| 34 | |
| 35 | runner.set_completion_callback([&](bool s, int ec) { |
| 36 | completed = true; |
| 37 | success = s; |
| 38 | exit_code = ec; |
| 39 | }); |
| 40 | |
| 41 | ASSERT_TRUE(runner.start({"--version"})); |
| 42 | EXPECT_TRUE(runner.is_running()); |
| 43 | |
| 44 | // Poll until complete |
| 45 | int iterations = 0; |
| 46 | while (runner.poll() && iterations < 1000) { |
| 47 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); |
| 48 | iterations++; |
| 49 | } |
| 50 | |
| 51 | // Should complete |
| 52 | EXPECT_TRUE(completed); |
| 53 | EXPECT_TRUE(success); |
| 54 | EXPECT_EQ(exit_code, 0); |
| 55 | EXPECT_FALSE(output.empty()); |
| 56 | EXPECT_TRUE(output.find("uv") != std::string::npos); |
| 57 | } |
| 58 | |
| 59 | TEST_F(UvRunnerTest, RunUvHelp) { |
| 60 | UvRunner runner; |
nothing calls this directly
no test coverage detected