@@ -117,9 +117,8 @@ class TestLibrary : public TestFixture {
117117 " </function>\n "
118118 " </def>" ;
119119
120- TokenList tokenList (&settings);
121- std::istringstream istr (" foo();" );
122- tokenList.createTokens (istr, Standards::Language::CPP);
120+ const char code[] = " foo();" ;
121+ SimpleTokenList tokenList (code);
123122 tokenList.front ()->next ()->astOperand1 (tokenList.front ());
124123
125124 Library library;
@@ -140,16 +139,14 @@ class TestLibrary : public TestFixture {
140139 Library library;
141140 ASSERT (loadxmldata (library, xmldata, sizeof (xmldata)));
142141 {
143- TokenList tokenList (&settings);
144- std::istringstream istr (" fred.foo(123);" ); // <- wrong scope, not library function
145- tokenList.createTokens (istr, Standards::Language::CPP);
142+ const char code[] = " fred.foo(123);" ; // <- wrong scope, not library function
143+ SimpleTokenList tokenList (code);
146144
147145 ASSERT (library.isNotLibraryFunction (tokenList.front ()->tokAt (2 )));
148146 }
149147 {
150- TokenList tokenList (&settings);
151- std::istringstream istr (" Fred::foo(123);" ); // <- wrong scope, not library function
152- tokenList.createTokens (istr, Standards::Language::CPP);
148+ const char code[] = " Fred::foo(123);" ; // <- wrong scope, not library function
149+ SimpleTokenList tokenList (code);
153150
154151 ASSERT (library.isNotLibraryFunction (tokenList.front ()->tokAt (2 )));
155152 }
@@ -232,9 +229,8 @@ class TestLibrary : public TestFixture {
232229 " </function>\n "
233230 " </def>" ;
234231
235- TokenList tokenList (&settings);
236- std::istringstream istr (" Fred foo(123);" ); // <- Variable declaration, not library function
237- tokenList.createTokens (istr, Standards::Language::CPP);
232+ const char code[] = " Fred foo(123);" ; // <- Variable declaration, not library function
233+ SimpleTokenList tokenList (code);
238234 tokenList.front ()->next ()->astOperand1 (tokenList.front ());
239235 tokenList.front ()->next ()->varId (1 );
240236
@@ -292,9 +288,8 @@ class TestLibrary : public TestFixture {
292288 ASSERT (loadxmldata (library, xmldata, sizeof (xmldata)));
293289 ASSERT_EQUALS (0 , library.functions [" foo" ].argumentChecks [-1 ].notuninit );
294290
295- TokenList tokenList (&settings);
296- std::istringstream istr (" foo(a,b,c,d,e);" );
297- tokenList.createTokens (istr, Standards::Language::CPP);
291+ const char code[] = " foo(a,b,c,d,e);" ;
292+ SimpleTokenList tokenList (code);
298293 tokenList.front ()->next ()->astOperand1 (tokenList.front ());
299294
300295 ASSERT_EQUALS (false , library.isuninitargbad (tokenList.front (), 1 ));
@@ -317,9 +312,8 @@ class TestLibrary : public TestFixture {
317312 Library library;
318313 ASSERT (loadxmldata (library, xmldata, sizeof (xmldata)));
319314
320- TokenList tokenList (&settings);
321- std::istringstream istr (" foo(a,b,c,d);" );
322- tokenList.createTokens (istr, Standards::Language::CPP);
315+ const char code[] = " foo(a,b,c,d);" ;
316+ SimpleTokenList tokenList (code);
323317 tokenList.front ()->next ()->astOperand1 (tokenList.front ());
324318
325319 ASSERT (Library::ArgumentChecks::Direction::DIR_IN == library.getArgDirection (tokenList.front (), 1 ));
@@ -349,9 +343,8 @@ class TestLibrary : public TestFixture {
349343 Library library;
350344 ASSERT (loadxmldata (library, xmldata, sizeof (xmldata)));
351345
352- TokenList tokenList (&settings);
353- std::istringstream istr (" foo(a,b,c,d,e,f,g,h,i,j,k);" );
354- tokenList.createTokens (istr, Standards::Language::CPP);
346+ const char code[] = " foo(a,b,c,d,e,f,g,h,i,j,k);" ;
347+ SimpleTokenList tokenList (code);
355348 tokenList.front ()->next ()->astOperand1 (tokenList.front ());
356349
357350 // 1-
@@ -491,9 +484,8 @@ class TestLibrary : public TestFixture {
491484 Library library;
492485 ASSERT (loadxmldata (library, xmldata, sizeof (xmldata)));
493486
494- TokenList tokenList (&settings);
495- std::istringstream istr (" foo(a,b,c,d,e);" );
496- tokenList.createTokens (istr, Standards::Language::CPP);
487+ const char code[] = " foo(a,b,c,d,e);" ;
488+ SimpleTokenList tokenList (code);
497489 tokenList.front ()->next ()->astOperand1 (tokenList.front ());
498490
499491 // arg1: type=strlen arg2
@@ -554,16 +546,14 @@ class TestLibrary : public TestFixture {
554546 ASSERT (library.functions .at (" bar" ).argumentChecks .empty ());
555547
556548 {
557- TokenList tokenList (&settings);
558- std::istringstream istr (" Foo::foo();" );
559- tokenList.createTokens (istr, Standards::Language::CPP);
549+ const char code[] = " Foo::foo();" ;
550+ SimpleTokenList tokenList (code);
560551 ASSERT (library.isnotnoreturn (tokenList.front ()->tokAt (2 )));
561552 }
562553
563554 {
564- TokenList tokenList (&settings);
565- std::istringstream istr (" bar();" );
566- tokenList.createTokens (istr, Standards::Language::CPP);
555+ const char code[] = " bar();" ;
556+ SimpleTokenList tokenList (code);
567557 ASSERT (library.isnotnoreturn (tokenList.front ()));
568558 }
569559 }
@@ -635,9 +625,8 @@ class TestLibrary : public TestFixture {
635625 Library library;
636626 ASSERT (loadxmldata (library, xmldata, sizeof (xmldata)));
637627
638- TokenList tokenList (&settings);
639- std::istringstream istr (" a(); b();" );
640- tokenList.createTokens (istr, Standards::Language::CPP);
628+ const char code[] = " a(); b();" ;
629+ SimpleTokenList tokenList (code);
641630
642631 const Library::WarnInfo* a = library.getWarnInfo (tokenList.front ());
643632 const Library::WarnInfo* b = library.getWarnInfo (tokenList.front ()->tokAt (4 ));
0 commit comments