test-rconfig-038.cc

Go to the documentation of this file.
00001 #include "config.h"
00002 
00003 #include <iostream>
00004 #include <string>
00005 #include <cassert>
00006 
00007 #ifdef HAVE_UNISTD_H
00008 #include <unistd.h>
00009 #endif
00010 
00011 #include <errno.h>
00012 
00013 #include "asserts.h"
00014 #include "types.h"
00015 #include "error.h"
00016 #include "estring.h"
00017 #include "fs.h"
00018 #include "tstamp.h"
00019 #include "rconfig.h"
00020 #include "test-rconfig-setup.h"
00021 
00022 // #define ERR_OUT(e) std::cerr << e;
00023 #define ERR_OUT(e)
00024 
00025 void test(void)
00026 {
00027         char *argv[256] = { 0 };
00028         int argc = 0;
00029         bool thrown = false;
00030 
00031         argv[argc++] = "<program>";
00032         argv[argc++] = "--archive";
00033 
00034         config.default_file("./test-rconfig.dir/job.dir/file-2.conf");
00035         config.default_logdir("./test-rconfig.dir/log.dir");
00036         try {
00037                 config.init(argc, argv);
00038         }
00039         catch(error e) {
00040                 ERR_OUT(e);
00041                 assert(e.num() == 0);
00042                 assert(!e.internal());
00043                 assert(e.size() == 3);
00044                 assert(e[0].what() == "Unknown command in job context: \"booga-booga\"");
00045                 assert(e[1].what() == "At ./test-rconfig.dir/job.dir/file-2.1.conf[4]");
00046                 assert(e[2].what() == "At ./test-rconfig.dir/job.dir/file-2.conf[4]");
00047                 thrown = true;
00048         }
00049         catch(...) {
00050                 assert(0);
00051         }
00052         assert(thrown);
00053 }
00054 
00055 int main(int argc, char *argv[])
00056 {
00057         cleanup();
00058         setup();
00059         try {
00060                 test();
00061         }
00062         catch(error e) {
00063                 std::cerr << e;
00064                 assert(0);
00065         }
00066         catch(...) {
00067                 std::cerr << err_unknown;
00068                 assert(0);
00069         }
00070         cleanup();
00071         return(0);
00072 }
00073 

Generated on Fri Jun 23 16:46:31 2006 for rvm by  doxygen 1.4.2