From f249acf5a12ec0a40584042354a4054343dc6425 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 30 Jul 2009 11:57:22 +0000 Subject: Added Exception class unit test. --- server/src/Makefile.am | 7 +++++++ server/src/exception.cc | 6 ++++++ 2 files changed, 13 insertions(+) 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; } -- cgit v1.2.3