From 02d391df5cb7a9cefcd6fec62c4392a8557b5dc8 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 27 Mar 2020 19:12:44 +0100 Subject: Fixes --- test-cpp.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'test-cpp.cpp') diff --git a/test-cpp.cpp b/test-cpp.cpp index 47a57f5..aabc4f4 100644 --- a/test-cpp.cpp +++ b/test-cpp.cpp @@ -40,11 +40,6 @@ TEST_F(CppTest, preprocessing_tokenize) { auto tokens = cpp.tokens_from_pptokens(pp_tokens); ASSERT_EQ(tokens.size(), 9); -#if 0 - for (auto &i: tokens) { - std::cout << i.type << ": " << i.value << std::endl; - } -#endif auto nodes = cpp.analysis(tokens); @@ -52,14 +47,23 @@ TEST_F(CppTest, preprocessing_tokenize) { } #endif -#if 0 -TEST_F(CppTest, preprocessing_tokenize2) { +TEST_F(CppTest, preprocessing_tokenize_compile_error) { CPP cpp; auto ppTree = cpp.preprocessing_tokenize("in ma"); - cpp.tokens_from_pptokens(ppTree); + auto tokens = cpp.tokens_from_pptokens(ppTree); + + ASSERT_EQ(tokens.size(), 2); + + try { + auto nodes = cpp.analysis(tokens); + } catch (const std::exception& ex) { + EXPECT_EQ(ex.what(), "Compile error"s); + return; + } + + FAIL() << "Exception expected"; } -#endif #if 0 TEST(Cpp, translate) { -- cgit v1.2.3