Added try/catch to testWrap so that it errors gracefully

release/4.3a0
Alex Cunningham 2010-07-14 14:00:40 +00:00
parent 20b09e5383
commit b2a0356965
1 changed files with 53 additions and 44 deletions

View File

@ -28,7 +28,8 @@ TEST( wrap, ArgumentList ) {
/* ************************************************************************* */ /* ************************************************************************* */
TEST( wrap, parse ) { TEST( wrap, parse ) {
Module module(".", "geometry",false); try {
Module module(".", "geometry",verbose);
CHECK(module.classes.size()==3); CHECK(module.classes.size()==3);
// check second class, Point3 // check second class, Point3
@ -54,12 +55,17 @@ TEST( wrap, parse ) {
CHECK(m1.name=="norm"); CHECK(m1.name=="norm");
CHECK(m1.args.size()==0); CHECK(m1.args.size()==0);
CHECK(m1.is_const); CHECK(m1.is_const);
} catch (CantOpenFile e) {
FAIL(e.what());
}
} }
/* ************************************************************************* */ /* ************************************************************************* */
TEST( wrap, matlab_code ) { TEST( wrap, matlab_code ) {
// Parse into class object // Parse into class object
Module module(".","geometry",false); try {
Module module(".","geometry",verbose);
// emit MATLAB code // emit MATLAB code
// make_geometry will not compile, use make testwrap to generate real make // make_geometry will not compile, use make testwrap to generate real make
@ -85,6 +91,9 @@ TEST( wrap, matlab_code ) {
CHECK(files_equal("expected/@Test/print.cpp" , "actual/@Test/print.cpp" )); CHECK(files_equal("expected/@Test/print.cpp" , "actual/@Test/print.cpp" ));
CHECK(files_equal("expected/make_geometry.m" , "actual/make_geometry.m" )); CHECK(files_equal("expected/make_geometry.m" , "actual/make_geometry.m" ));
} catch (CantOpenFile e) {
FAIL(e.what()); // fails if file is in wrong place
}
} }
/* ************************************************************************* */ /* ************************************************************************* */