Bug 557383: Remove unused variable warning and add extra failure check. r=dholbert

This commit is contained in:
Chris Jones 2010-04-14 21:09:35 -05:00
parent 3569ac83b4
commit 286a291a3e

View File

@ -22,14 +22,21 @@
int main() {
std::vector<int> v;
int rv = 1;
TRY {
// this should abort; NOT throw an exception
int unused = v.at(1);
// v.at(1) on empty v should abort; NOT throw an exception
// (Do some arithmetic with result of v.at() to avoid
// compiler warnings for unused variable/result.)
rv += v.at(1) ? 1 : 2;
} CATCH(const std::out_of_range& e) {
fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception!\n",
fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception?\n",
stderr);
return 1;
}
return 0;
fputs("TEST-FAIL | TestSTLWrappers.cpp | didn't abort()?\n",
stderr);
return rv;
}