@@ -1261,7 +1261,28 @@ TEST(FunctionReflectionTest, UndoTest) {
12611261 EXPECT_STREQ (cerrs.c_str (), " " );
12621262 Cpp::Undo ();
12631263 testing::internal::CaptureStderr ();
1264+ Cpp::Process (" int y = x;" );
1265+ cerrs = testing::internal::GetCapturedStderr ();
1266+ EXPECT_STREQ (
1267+ cerrs.c_str (),
1268+ " In file included from <<< inputs >>>:1:\n input_line_2:1:9: error: use "
1269+ " of undeclared identifier 'x'\n 1 | int y = x;\n | "
1270+ " ^\n Failed to parse via ::process:Parsing failed.\n " );
1271+ testing::internal::CaptureStderr ();
12641272 Cpp::Process (" int x = 10;" );
12651273 cerrs = testing::internal::GetCapturedStderr ();
12661274 EXPECT_STREQ (cerrs.c_str (), " " );
1275+ testing::internal::CaptureStderr ();
1276+ Cpp::Process (" int y = 10;" );
1277+ cerrs = testing::internal::GetCapturedStderr ();
1278+ EXPECT_STREQ (cerrs.c_str (), " " );
1279+ Cpp::Undo (2 );
1280+ testing::internal::CaptureStderr ();
1281+ Cpp::Process (" int x = 20;" );
1282+ cerrs = testing::internal::GetCapturedStderr ();
1283+ EXPECT_STREQ (cerrs.c_str (), " " );
1284+ testing::internal::CaptureStderr ();
1285+ Cpp::Process (" int y = 20;" );
1286+ cerrs = testing::internal::GetCapturedStderr ();
1287+ EXPECT_STREQ (cerrs.c_str (), " " );
12671288}
0 commit comments