summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-02-16 15:19:16 +0100
committerRoland Reichwein <mail@reichwein.it>2020-02-16 15:19:16 +0100
commit0aaa6440a23e1dedf4a907fa46f979ea9d248e99 (patch)
tree8637383b79beb46530cc7988229d2d4c8b16d07a
parent2ae1fd90afe236f8815921362c5d45a201dd4476 (diff)
Fix test
-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[]) {