src/test/error_test.cc
changeset 727 aada518af30f
parent 542 69bde1d90c04
child 906 17f31d280385
     1.1 --- a/src/test/error_test.cc	Thu Jul 22 14:19:23 2004 +0000
     1.2 +++ b/src/test/error_test.cc	Thu Jul 22 14:21:46 2004 +0000
     1.3 @@ -1,7 +1,7 @@
     1.4  #include <iostream>
     1.5  
     1.6  #include <hugo/error.h>
     1.7 -
     1.8 +#include "test_tools.h"
     1.9  using namespace hugo;
    1.10  using std::cout;
    1.11  using std::endl;
    1.12 @@ -21,37 +21,29 @@
    1.13  
    1.14  
    1.15  int main() {
    1.16 -  bool no_errors = false;
    1.17 -
    1.18    try {
    1.19 -    cout << "Trying a faulty function\n";
    1.20      faulty_fn();
    1.21 -    no_errors = true;
    1.22 -    cout << "FAILED!\n";
    1.23 +    check(false, "A faulty function did not fail.");
    1.24    }
    1.25    catch(const Exception &e) {
    1.26 -    cout << "E: " << e.what() << endl;
    1.27 +    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
    1.28    }
    1.29  
    1.30    try {
    1.31 -    cout << "Trying a function throwing Exception\n";
    1.32      exception_fn();
    1.33 -    no_errors = true;
    1.34 -    cout << "FAILED!\n";
    1.35 +    check(false, "The function did not throw Exception.");
    1.36    }
    1.37    catch(const Exception &e) {
    1.38 -    cout << "E: " << e.what() << endl;
    1.39 +    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
    1.40    }
    1.41  
    1.42    try {
    1.43 -    cout << "Trying a function using FIXME\n";
    1.44      unfinished_fn();
    1.45 -    no_errors = true;
    1.46 -    cout << "FAILED!\n";
    1.47 +    check(false, "FIXME macro does not work.");
    1.48    }
    1.49    catch(const Exception &e) {
    1.50 -    cout << "E: " << e.what() << endl;
    1.51 +    cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
    1.52    }
    1.53  
    1.54 -  return no_errors ? 1 : 0;
    1.55 +  return 0;
    1.56  }