@@ -6400,22 +6400,32 @@ class TestTokenizer : public TestFixture {
64006400 Z3
64016401 };
64026402
6403+ enum class ListSimplification : std::uint8_t {
6404+ Partial,
6405+ Full
6406+ };
6407+
64036408 template <size_t size>
6404- std::string testAst (const char (&data)[size], AstStyle style = AstStyle::Simple) {
6409+ std::string testAst (const char (&data)[size], AstStyle style = AstStyle::Simple, ListSimplification ls = ListSimplification::Partial ) {
64056410 // tokenize given code..
64066411 TokenList tokenlist{settings0, Standards::Language::CPP};
64076412 tokenlist.appendFileIfNew (" test.cpp" );
64086413 if (!tokenlist.createTokensFromString (data))
64096414 return " ERROR" ;
64106415
64116416 TokenizerTest tokenizer (std::move (tokenlist), *this );
6412- tokenizer.combineStringAndCharLiterals ();
6413- tokenizer.combineOperators ();
6414- tokenizer.simplifySpaceshipOperator ();
6415- tokenizer.createLinks ();
6416- tokenizer.createLinks2 ();
6417- tokenizer.simplifyCAlternativeTokens ();
6418- tokenizer.list .front ()->assignIndexes ();
6417+ if (ls == ListSimplification::Partial) {
6418+ tokenizer.combineStringAndCharLiterals ();
6419+ tokenizer.combineOperators ();
6420+ tokenizer.simplifySpaceshipOperator ();
6421+ tokenizer.createLinks ();
6422+ tokenizer.createLinks2 ();
6423+ tokenizer.simplifyCAlternativeTokens ();
6424+ tokenizer.simplifyOperatorName ();
6425+ tokenizer.list .front ()->assignIndexes ();
6426+ } else { // Full
6427+ tokenizer.simplifyTokens1 (" " );
6428+ }
64196429
64206430 // set varid..
64216431 for (Token *tok = tokenizer.list .front (); tok; tok = tok->next ()) {
@@ -7408,6 +7418,11 @@ class TestTokenizer : public TestFixture {
74087418 ASSERT_EQUALS (" A0U=" , testAst (" enum myclass : unsigned char { A = 0U, };" ));
74097419 }
74107420
7421+ void astfuncdecl () {
7422+ ASSERT_EQUALS (" " , testAst (" bool operator==(const S& a, const S& b);" , AstStyle::Simple, ListSimplification::Full));
7423+ ASSERT_EQUALS (" " , testAst (" ::int32_t f() {}" ));
7424+ }
7425+
74117426#define isStartOfExecutableScope (offset, code ) isStartOfExecutableScope_(offset, code, __FILE__, __LINE__)
74127427 template <size_t size>
74137428 bool isStartOfExecutableScope_ (int offset, const char (&code)[size], const char* file, int line) {
0 commit comments