From 0aaa6440a23e1dedf4a907fa46f979ea9d248e99 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 16 Feb 2020 15:19:16 +0100 Subject: Fix test --- test-lexer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test-lexer.cpp b/test-lexer.cpp index c2bc824..651dfae 100644 --- a/test-lexer.cpp +++ b/test-lexer.cpp @@ -123,7 +123,12 @@ TEST_F(Test, BNF) { tokens = lexer.Lex(Code2); ASSERT_EQ(tokens, tokens_reference2); CPP::PreprocessorTokensToTokens(tokens); - Tree = compiler.compile(tokens); + try { + Tree = compiler.compile(tokens); + FAIL() << "compile() was expected to throw."s; + } catch (const std::runtime_error& ex) { + ASSERT_EQ(std::string{ex.what()}, "Compile error: Invalid program."); + } } int main(int argc, char* argv[]) { -- cgit v1.2.3