@@ -427,6 +427,7 @@ class TestTokenizer : public TestFixture {
427427 TEST_CASE (astorkeyword);
428428 TEST_CASE (astenumdecl);
429429 TEST_CASE (astcompound);
430+ TEST_CASE (astfuncdecl);
430431
431432 TEST_CASE (startOfExecutableScope);
432433
@@ -6415,22 +6416,31 @@ class TestTokenizer : public TestFixture {
64156416 Z3
64166417 };
64176418
6419+ enum class ListSimplification : std::uint8_t {
6420+ Partial,
6421+ Full
6422+ };
6423+
64186424 template <size_t size>
6419- std::string testAst (const char (&data)[size], AstStyle style = AstStyle::Simple) {
6425+ std::string testAst (const char (&data)[size], AstStyle style = AstStyle::Simple, ListSimplification ls = ListSimplification::Partial ) {
64206426 // tokenize given code..
64216427 TokenList tokenlist{settings0, Standards::Language::CPP};
64226428 tokenlist.appendFileIfNew (" test.cpp" );
64236429 if (!tokenlist.createTokensFromString (data))
64246430 return " ERROR" ;
64256431
64266432 TokenizerTest tokenizer (std::move (tokenlist), *this );
6427- tokenizer.combineStringAndCharLiterals ();
6428- tokenizer.combineOperators ();
6429- tokenizer.simplifySpaceshipOperator ();
6430- tokenizer.createLinks ();
6431- tokenizer.createLinks2 ();
6432- tokenizer.simplifyCAlternativeTokens ();
6433- tokenizer.list .front ()->assignIndexes ();
6433+ if (ls == ListSimplification::Partial) {
6434+ tokenizer.combineStringAndCharLiterals ();
6435+ tokenizer.combineOperators ();
6436+ tokenizer.simplifySpaceshipOperator ();
6437+ tokenizer.createLinks ();
6438+ tokenizer.createLinks2 ();
6439+ tokenizer.simplifyCAlternativeTokens ();
6440+ tokenizer.list .front ()->assignIndexes ();
6441+ } else { // Full
6442+ tokenizer.simplifyTokens1 (" " );
6443+ }
64346444
64356445 // set varid..
64366446 for (Token *tok = tokenizer.list .front (); tok; tok = tok->next ()) {
@@ -7428,6 +7438,11 @@ class TestTokenizer : public TestFixture {
74287438 ASSERT_EQUALS (" s(sstrlens(0:?,{(return" , testAst (" return (struct Str) { (unsigned char*)s, s ? strlen(s) : 0 };" ));
74297439 }
74307440
7441+ void astfuncdecl () {
7442+ ASSERT_EQUALS (" " , testAst (" bool operator==(const S& a, const S& b);" , AstStyle::Simple, ListSimplification::Full));
7443+ ASSERT_EQUALS (" " , testAst (" ::int32_t f();" ));
7444+ }
7445+
74317446#define isStartOfExecutableScope (offset, code ) isStartOfExecutableScope_(offset, code, __FILE__, __LINE__)
74327447 template <size_t size>
74337448 bool isStartOfExecutableScope_ (int offset, const char (&code)[size], const char* file, int line) {
0 commit comments