diff options
Diffstat (limited to 'test-cpp.cpp')
-rw-r--r-- | test-cpp.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
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) { |