File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,6 +240,11 @@ class TestVarID : public TestFixture {
240240 TEST_CASE (decltype1);
241241 TEST_CASE (decltype2);
242242
243+ TEST_CASE (typeof1);
244+ TEST_CASE (typeof2);
245+ TEST_CASE (typeof3);
246+ TEST_CASE (typeof4);
247+
243248 TEST_CASE (exprid1);
244249 TEST_CASE (exprid2);
245250 TEST_CASE (exprid3);
@@ -4189,6 +4194,32 @@ class TestVarID : public TestFixture {
41894194 ASSERT_EQUALS (expected, tokenize (code));
41904195 }
41914196
4197+ void typeof1 () {
4198+ const char code[] = " int x; typeof(x) y;" ;
4199+ const char expected[] = " 1: int x@1 ; typeof ( x@1 ) y@2 ;\n " ;
4200+ ASSERT_EQUALS (expected, tokenize (code));
4201+ }
4202+
4203+ void typeof2 () {
4204+ const char code[] = " int x; typeof(x) *y;" ;
4205+ const char expected[] = " 1: int x@1 ; typeof ( x@1 ) * y@2 ;\n " ;
4206+ ASSERT_EQUALS (expected, tokenize (code));
4207+ }
4208+
4209+ void typeof3 () {
4210+ const char code[] = " int x; const typeof(x) *const y;" ;
4211+ const char expected[] = " 1: int x@1 ; const typeof ( x@1 ) * const y@2 ;\n " ;
4212+ ASSERT_EQUALS (expected, tokenize (code));
4213+ }
4214+
4215+ void typeof4 () {
4216+ const char code[] = " int x; __typeof(x) y;" ;
4217+ const char expected[] = " 1: int x@1 ; __typeof ( x@1 ) y@2 ;\n " ;
4218+ TokenizeOptions options;
4219+ options.cpp = false ;
4220+ ASSERT_EQUALS (expected, tokenize (code, options));
4221+ }
4222+
41924223 void exprid1 () {
41934224 const std::string actual = tokenizeExpr (
41944225 " struct A {\n "
You can’t perform that action at this time.
0 commit comments