summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test-lexer.cpp7
1 files changed, 6 insertions, 1 deletions
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[]) {