Extend symbol database test for const volatile member function. (#1220)

This commit is contained in:
IOBYTE 2018-05-11 02:15:46 -04:00 committed by amai2012
parent 7b6ddc50ae
commit 9d30496ea1
1 changed files with 11 additions and 3 deletions

View File

@ -3868,21 +3868,29 @@ private:
void symboldatabase69() { void symboldatabase69() {
GET_SYMBOL_DB("struct Fred {\n" GET_SYMBOL_DB("struct Fred {\n"
" int x, y;\n" " int x, y;\n"
" void foo() const volatile { }\n"
" void foo() volatile { }\n" " void foo() volatile { }\n"
" void foo() const { }\n" " void foo() const { }\n"
" void foo() { }\n" " void foo() { }\n"
"};"); "};");
const Token *f = db ? Token::findsimplematch(tokenizer.tokens(), "foo ( ) volatile {") : nullptr; const Token *f = db ? Token::findsimplematch(tokenizer.tokens(), "foo ( ) const volatile {") : nullptr;
ASSERT(f != nullptr); ASSERT(f != nullptr);
ASSERT(f && f->function() && f->function()->token->linenr() == 3); ASSERT(f && f->function() && f->function()->token->linenr() == 3);
ASSERT(f && f->function() && f->function()->isConst());
ASSERT(f && f->function() && f->function()->isVolatile());
f = db ? Token::findsimplematch(tokenizer.tokens(), "foo ( ) volatile {") : nullptr;
ASSERT(f != nullptr);
ASSERT(f && f->function() && f->function()->token->linenr() == 4);
ASSERT(f && f->function() && !f->function()->isConst());
ASSERT(f && f->function() && f->function()->isVolatile()); ASSERT(f && f->function() && f->function()->isVolatile());
f = db ? Token::findsimplematch(tokenizer.tokens(), "foo ( ) const {") : nullptr; f = db ? Token::findsimplematch(tokenizer.tokens(), "foo ( ) const {") : nullptr;
ASSERT(f != nullptr); ASSERT(f != nullptr);
ASSERT(f && f->function() && f->function()->token->linenr() == 4); ASSERT(f && f->function() && f->function()->token->linenr() == 5);
ASSERT(f && f->function() && f->function()->isConst()); ASSERT(f && f->function() && f->function()->isConst());
ASSERT(f && f->function() && !f->function()->isVolatile());
f = db ? Token::findsimplematch(tokenizer.tokens(), "foo ( ) {") : nullptr; f = db ? Token::findsimplematch(tokenizer.tokens(), "foo ( ) {") : nullptr;
ASSERT(f != nullptr); ASSERT(f != nullptr);
ASSERT(f && f->function() && f->function()->token->linenr() == 5); ASSERT(f && f->function() && f->function()->token->linenr() == 6);
ASSERT(f && f->function() && !f->function()->isVolatile()); ASSERT(f && f->function() && !f->function()->isVolatile());
ASSERT(f && f->function() && !f->function()->isConst()); ASSERT(f && f->function() && !f->function()->isConst());
} }