Ticket #5776: Since the fix is in Tokenizer, it makes more sense to have a Tokenizer unit test.

This commit is contained in:
Simon Martin 2015-07-19 00:10:47 +02:00
parent ce7e879460
commit d218b95349
2 changed files with 1 additions and 9 deletions

View File

@ -692,6 +692,7 @@ private:
ASSERT_EQUALS("void f ( ) { int p ; if ( ! p ) { } }", tok("void f(){int p; if ((p) == 0) {}}")); ASSERT_EQUALS("void f ( ) { int p ; if ( ! p ) { } }", tok("void f(){int p; if ((p) == 0) {}}"));
ASSERT_EQUALS("void f ( ) { int * p ; * p = 1 ; }", tok("void f(){int *p; *(p) = 1;}")); ASSERT_EQUALS("void f ( ) { int * p ; * p = 1 ; }", tok("void f(){int *p; *(p) = 1;}"));
ASSERT_EQUALS("void f ( ) { int p ; if ( p ) { } p = 1 ; }", tok("void f(){int p; if ( p ) { } (p) = 1;}")); ASSERT_EQUALS("void f ( ) { int p ; if ( p ) { } p = 1 ; }", tok("void f(){int p; if ( p ) { } (p) = 1;}"));
ASSERT_EQUALS("void f ( ) { a . b ; }", tok("void f ( ) { ( & a ) -> b ; }")); // Ticket #5776
// keep parentheses.. // keep parentheses..
ASSERT_EQUALS("b = a ;", tok("b = (char)a;")); ASSERT_EQUALS("b = a ;", tok("b = (char)a;"));

View File

@ -3547,15 +3547,6 @@ private:
" x = a.m;\n" " x = a.m;\n"
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
// Ticket #5776
checkUninitVar2("typedef struct { int a, b; } AB;\n"
"void f(void) {\n"
" AB ab;\n"
" ab.a = 1;\n"
" return (&ab)->b;\n"
"}", "test.c");
ASSERT_EQUALS("[test.c:5]: (error) Uninitialized struct member: ab.b\n", errout.str());
} }
void uninitvar2_while() { void uninitvar2_while() {