diff options
| -rwxr-xr-x | tools/unittests/test_tokenizer.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/unittests/test_tokenizer.py b/tools/unittests/test_tokenizer.py index 5634b4a7283e..d1f3c565b9cf 100755 --- a/tools/unittests/test_tokenizer.py +++ b/tools/unittests/test_tokenizer.py @@ -46,10 +46,17 @@ def make_tokenizer_test(name, data): # # Check if logger is working # - if "log_level" in data: - with self.assertLogs('kdoc.c_lex', level='ERROR') as cm: + if "log_msg" in data: + with self.assertLogs() as cm: tokenizer = CTokenizer(data["source"]) + msg_found = False + for result in cm.output: + if data["log_msg"] in result: + msg_found = True + + self.assertTrue(msg_found, f"Missing log {data['log_msg']}") + return # @@ -124,7 +131,7 @@ TESTS_TOKENIZER = { "mismatch_error": { "source": "int a$ = 5;", # $ is illegal - "log_level": "ERROR", + "log_msg": "Unexpected token", }, } |
