summaryrefslogtreecommitdiff
path: root/server/src/templateparser.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-17 11:00:14 +0000
committerdeva <deva>2011-02-17 11:00:14 +0000
commitdb144840aba95affb3a6b5b2536059f49f0677ff (patch)
tree1c397a20aa5745c6bbb5dee6a4409f58c4542e87 /server/src/templateparser.cc
parentc8651b8c89673300477ab86962640c93216ea306 (diff)
Rewrite of all old tests to new unittest framework. Also some work on testdb; more to come...
Diffstat (limited to 'server/src/templateparser.cc')
-rw-r--r--server/src/templateparser.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc
index b34f280..20270c6 100644
--- a/server/src/templateparser.cc
+++ b/server/src/templateparser.cc
@@ -161,6 +161,10 @@ Template *TemplateParser::getTemplate()
}
#ifdef TEST_TEMPLATEPARSER
+//deps: saxparser.cc debug.cc log.cc exception.cc
+//cflags: -I.. $(EXPAT_CFLAGS)
+//libs: $(EXPAT_LIBS)
+#include <test.h>
#define XMLFILE "/tmp/test_templateparser.xml"
@@ -170,7 +174,7 @@ Template *TemplateParser::getTemplate()
#include <string.h>
#include <stdio.h>
#include <memory.h>
-
+/*
static char xml[] =
"<?xml version='1.0' encoding='UTF-8'?>\n"
"<template name=\"testtemplate\" version=\"1.0\">\n"
@@ -194,15 +198,20 @@ static char xml_fail[] =
" <someothertag/>\n"
"</template>"
;
+*/
-int main()
-{
+TEST_BEGIN;
+
+// TODO: Put some testcode here (see test.h for usable macros).
+TEST_TRUE(false, "No tests yet!");
+
+/*
FILE *fp = fopen(XMLFILE, "w");
if(!fp) {
printf("Could not write to %s\n", XMLFILE);
return 1;
}
- fprintf(fp, xml);
+fprintf(fp, "%s", xml);
fclose(fp);
{
@@ -221,7 +230,7 @@ int main()
printf("Could not write to %s\n", XMLFILE);
return 1;
}
- fprintf(fp, xml_nontemplate);
+fprintf(fp, "%s", xml_nontemplate);
fclose(fp);
// Test parsing of correct xml data, but not template (should throw an exception).
@@ -242,7 +251,7 @@ int main()
printf("Could not write to %s\n", XMLFILE);
return 1;
}
- fprintf(fp, xml_fail);
+fprintf(fp, "%s", xml_fail);
fclose(fp);
// Test parsing of invalid xml data (should throw an exception).
@@ -259,8 +268,7 @@ int main()
yetonandon:
unlink(XMLFILE);
-
- return 0;
-}
+*/
+TEST_END;
#endif/*TEST_TEMPLATEPARSER*/