symbol database: add simple try/catch tests

This commit is contained in:
Robert Reif 2012-01-25 22:48:18 -05:00
parent 6b0aff487f
commit 4d56395504
2 changed files with 22 additions and 0 deletions

View File

@ -553,6 +553,10 @@ public:
return _variableList[varId];
}
size_t getVariableListSize() const {
return _variableList.size();
}
/**
* @brief output a debug message
*/

View File

@ -113,6 +113,8 @@ private:
TEST_CASE(namespaces1);
TEST_CASE(namespaces2);
TEST_CASE(tryCatch1);
TEST_CASE(symboldatabase1);
TEST_CASE(symboldatabase2);
TEST_CASE(symboldatabase3); // ticket #2000
@ -726,6 +728,22 @@ private:
}
void tryCatch1() {
const std::string str("void foo() {\n"
" try { }\n"
" catch (const Error1 & x) { }\n"
" catch (const X::Error2 & x) { }\n"
" catch (Error3 x) { }\n"
" catch (X::Error4 x) { }\n"
"}\n");
GET_SYMBOL_DB(str.c_str())
check(str.c_str(), false);
ASSERT_EQUALS("", errout.str());
ASSERT(db && db->getVariableListSize() == 5); // index 0 + 4 variables
ASSERT(db && db->scopeList.size() == 7); // global + function + try + 4 catch
}
void symboldatabase1() {
check("namespace foo {\n"
" class bar;\n"