Skip to content

Commit c5e9a48

Browse files
committed
test
1 parent 4ffe325 commit c5e9a48

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎test/testtokenize.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ class TestTokenizer : public TestFixture {
467467
// Make sure the Tokenizer::findGarbageCode() does not have false positives
468468
// The TestGarbage ensures that there are true positives
469469
TEST_CASE(findGarbageCode);
470+
TEST_CASE(nameBraceAtNamespaceScope);
470471
TEST_CASE(checkEnableIf);
471472
TEST_CASE(checkTemplates);
472473
TEST_CASE(checkNamespaces);
@@ -8068,6 +8069,14 @@ class TestTokenizer : public TestFixture {
80688069
ignore_errout();
80698070
}
80708071

8072+
void nameBraceAtNamespaceScope() {
8073+
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("x{a}\n"), SYNTAX, "syntax error");
8074+
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("ABC { void f() {} }\n"),
8075+
UNKNOWN_MACRO,
8076+
"There is an unknown macro here somewhere. Configuration is required. If ABC is a macro then please configure it.");
8077+
ASSERT_NO_THROW(tokenizeAndStringify("DECLARE_FUNCTION { return 0; }\n"));
8078+
}
8079+
80718080
void findGarbageCode() { // Test Tokenizer::findGarbageCode()
80728081
// C++ try/catch in global scope
80738082
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("try { }\n"), SYNTAX, "syntax error: keyword 'try' is not allowed in global scope");

0 commit comments

Comments
 (0)