diff options
author | deva <deva> | 2009-07-30 11:57:22 +0000 |
---|---|---|
committer | deva <deva> | 2009-07-30 11:57:22 +0000 |
commit | f249acf5a12ec0a40584042354a4054343dc6425 (patch) | |
tree | dfef0e2d956b0669bd3eb5245d81fd72e4197ae7 | |
parent | 8d279b1839cb33de534c907c0731ddb3e4b7159e (diff) |
Added Exception class unit test.
-rw-r--r-- | server/src/Makefile.am | 7 | ||||
-rw-r--r-- | server/src/exception.cc | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/server/src/Makefile.am b/server/src/Makefile.am index 2276347..d797bc6 100644 --- a/server/src/Makefile.am +++ b/server/src/Makefile.am @@ -106,6 +106,7 @@ EXTRA_DIST = \ ################ TESTFILES = \ + test_exception \ test_templateheaderparser \ test_macroheaderparser \ test_templatelist \ @@ -141,6 +142,12 @@ test: $(TESTFILES) test_clean: rm -f $(TESTFILES) $(TESTLOGS) +TEST_EXCEPTION_FILES = \ + exception.cc \ + log.cc +test_exception: $(TEST_EXCEPTION_FILES) + @../../tools/test $(TEST_EXCEPTION_FILES) + TEST_TEMPLATEHEADERPARSER_FILES = \ templateheaderparser.cc \ $(PARSERFILES) \ diff --git a/server/src/exception.cc b/server/src/exception.cc index 57bd6bf..09c6918 100644 --- a/server/src/exception.cc +++ b/server/src/exception.cc @@ -63,13 +63,19 @@ int main() throw MyException(); } catch( MyException &e ) { printf("%s\n", e.what()); + goto on; } + return 1; + on: try { throw MyExtException("Yeaaah!"); } catch( MyExtException &e ) { printf("%s\n", e.what()); + goto onandon; } + return 1; + onandon: return 0; } |