Skip to content

Commit 646afb7

Browse files
committed
test
1 parent 4ffe325 commit 646afb7

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎test/testgarbage.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ class TestGarbage : public TestFixture {
870870
ASSERT_THROW_INTERNAL_EQUALS(checkCode("{ xs :: i(:) ! ! x/5 ! !\n"
871871
"i, :: a :: b integer, } foo2(x) :: j(:)\n"
872872
"b type(*), d(:), a x :: end d(..), foo end\n"
873-
"foo4 b d(..), a a x type(*), b foo2 b\n"), SYNTAX, "syntax error");
873+
"foo4 b d(..), a a x type(*), b foo2 b\n"), SYNTAX, "syntax error: ..");
874874
}
875875

876876
void garbageCode100() { // #6840

‎test/testtokenize.cpp‎

Lines changed: 11 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(memberAccessWithoutName);
470471
TEST_CASE(checkEnableIf);
471472
TEST_CASE(checkTemplates);
472473
TEST_CASE(checkNamespaces);
@@ -8068,6 +8069,16 @@ class TestTokenizer : public TestFixture {
80688069
ignore_errout();
80698070
}
80708071

8072+
void memberAccessWithoutName() {
8073+
const char code[] = "void f(void) {\n"
8074+
"\ti = x->(a, b);\n"
8075+
"}\n";
8076+
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify(code, dinit(TokenizeOptions, $.cpp = false)), SYNTAX, "syntax error: ->(");
8077+
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("void f(P *p) { p->1; }\n"), SYNTAX, "syntax error: ->1");
8078+
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("void f(P p) { p.; }\n"), SYNTAX, "syntax error: .;");
8079+
ASSERT_NO_THROW(tokenizeAndStringify("void f(P *p) { p.operator->(); }\n"));
8080+
}
8081+
80718082
void findGarbageCode() { // Test Tokenizer::findGarbageCode()
80728083
// C++ try/catch in global scope
80738084
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("try { }\n"), SYNTAX, "syntax error: keyword 'try' is not allowed in global scope");

0 commit comments

Comments
 (0)