Skip to content

Commit 9abe357

Browse files
committed
add tests
1 parent b067f37 commit 9abe357

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/testvarid.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff 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,30 @@ 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+
ASSERT_EQUALS(expected, tokenize(code));
4219+
}
4220+
41924221
void exprid1() {
41934222
const std::string actual = tokenizeExpr(
41944223
"struct A {\n"

0 commit comments

Comments
 (0)