Skip to content

Commit 67fc553

Browse files
author
kr-2003
committed
using Cpp::Process ret val
1 parent d04605a commit 67fc553

File tree

1 file changed

+21
-40
lines changed

1 file changed

+21
-40
lines changed

unittests/CppInterOp/FunctionReflectionTest.cpp

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,43 +1519,24 @@ TEST(FunctionReflectionTest, Destruct) {
15191519
}
15201520

15211521
TEST(FunctionReflectionTest, UndoTest) {
1522-
#ifdef EMSCRIPTEN
1523-
GTEST_SKIP()
1524-
<< "Test fails for Emscipten builds";
1525-
#else
1526-
Cpp::CreateInterpreter();
1527-
std::string cerrs;
1528-
testing::internal::CaptureStderr();
1529-
Cpp::Process("int x = 5;");
1530-
cerrs = testing::internal::GetCapturedStderr();
1531-
EXPECT_STREQ(cerrs.c_str(), "");
1532-
Cpp::Undo();
1533-
testing::internal::CaptureStderr();
1534-
Cpp::Process("int y = x;");
1535-
cerrs = testing::internal::GetCapturedStderr();
1536-
EXPECT_TRUE(strstr(cerrs.c_str(), "use of undeclared identifier 'x'") != nullptr);
1537-
testing::internal::CaptureStderr();
1538-
Cpp::Process("int x = 10;");
1539-
cerrs = testing::internal::GetCapturedStderr();
1540-
EXPECT_STREQ(cerrs.c_str(), "");
1541-
testing::internal::CaptureStderr();
1542-
Cpp::Process("int y = 10;");
1543-
cerrs = testing::internal::GetCapturedStderr();
1544-
EXPECT_STREQ(cerrs.c_str(), "");
1545-
Cpp::Undo(2);
1546-
testing::internal::CaptureStderr();
1547-
Cpp::Process("int x = 20;");
1548-
cerrs = testing::internal::GetCapturedStderr();
1549-
EXPECT_STREQ(cerrs.c_str(), "");
1550-
testing::internal::CaptureStderr();
1551-
Cpp::Process("int y = 20;");
1552-
cerrs = testing::internal::GetCapturedStderr();
1553-
EXPECT_STREQ(cerrs.c_str(), "");
1554-
int ret = Cpp::Undo(100);
1555-
#ifdef CPPINTEROP_USE_CLING
1556-
EXPECT_EQ(ret, 0);
1557-
#else
1558-
EXPECT_EQ(ret, 1);
1559-
#endif
1560-
#endif
1561-
}
1522+
#ifdef EMSCRIPTEN
1523+
GTEST_SKIP()
1524+
<< "Test fails for Emscipten builds";
1525+
#else
1526+
Cpp::CreateInterpreter();
1527+
EXPECT_EQ(Cpp::Process("int x = 5;"), 0);
1528+
Cpp::Undo();
1529+
EXPECT_NE(Cpp::Process("int y = x;"), 0);
1530+
EXPECT_EQ(Cpp::Process("int x = 10;"), 0);
1531+
EXPECT_EQ(Cpp::Process("int y = 10;"), 0);
1532+
Cpp::Undo(2);
1533+
EXPECT_EQ(Cpp::Process("int x = 20;"), 0);
1534+
EXPECT_EQ(Cpp::Process("int y = 20;"), 0);
1535+
int ret = Cpp::Undo(100);
1536+
#ifdef CPPINTEROP_USE_CLING
1537+
EXPECT_EQ(ret, 0);
1538+
#else
1539+
EXPECT_EQ(ret, 1);
1540+
#endif
1541+
#endif
1542+
}

0 commit comments

Comments
 (0)