SymbolDatabase: Added unit test that ensure the dimension is 0 when it is unknown (#3964)
This commit is contained in:
parent
b50a36e3f9
commit
9f6a11f89c
|
@ -62,6 +62,8 @@ private:
|
|||
}
|
||||
|
||||
void run() {
|
||||
TEST_CASE(array);
|
||||
|
||||
TEST_CASE(test_isVariableDeclarationCanHandleNull);
|
||||
TEST_CASE(test_isVariableDeclarationIdentifiesSimpleDeclaration);
|
||||
TEST_CASE(test_isVariableDeclarationIdentifiesScopedDeclaration);
|
||||
|
@ -153,6 +155,17 @@ private:
|
|||
TEST_CASE(isImplicitlyVirtual);
|
||||
}
|
||||
|
||||
void array() {
|
||||
std::istringstream code("int a[10+2];");
|
||||
TokenList list(NULL);
|
||||
list.createTokens(code, "test.c");
|
||||
list.front()->tokAt(2)->link(list.front()->tokAt(6));
|
||||
Variable v(list.front()->next(), list.front(), list.back(), 0, Public, NULL, NULL);
|
||||
ASSERT(v.isArray());
|
||||
ASSERT_EQUALS(1U, v.dimensions().size());
|
||||
ASSERT_EQUALS(0U, v.dimension(0));
|
||||
}
|
||||
|
||||
void test_isVariableDeclarationCanHandleNull() {
|
||||
reset();
|
||||
bool result = si.isVariableDeclaration(NULL, vartok, typetok);
|
||||
|
|
Loading…
Reference in New Issue