X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fnfaxmltest1.c;h=4fc7af6b7379b3786f663ef2200aed591e38c2ad;hb=c372821536d22c1b7efb290fb7d120ae5151adf2;hp=106c78d7dfdb7c55f2ee94f8a9b8b9a543d00e36;hpb=fc6d778b923000b5c6ad8e108b0b184178a9d33f;p=yaz-moved-to-github.git diff --git a/test/nfaxmltest1.c b/test/nfaxmltest1.c index 106c78d..4fc7af6 100644 --- a/test/nfaxmltest1.c +++ b/test/nfaxmltest1.c @@ -1,7 +1,7 @@ /* Copyright (C) 2006, Index Data ApS * See the file LICENSE for details. * - * $Id: nfaxmltest1.c,v 1.2 2006-07-06 10:17:55 adam Exp $ + * $Id: nfaxmltest1.c,v 1.4 2006-07-07 07:11:05 adam Exp $ * */ @@ -17,6 +17,7 @@ #include +/** \brief Test parsing of a minimal, valid xml string */ void test1() { char *xmlstr=" " " " @@ -24,18 +25,37 @@ void test1() { " bar " "" ""; - xmlDocPtr doc = xmlParseMemory(xmlstr, strlen(xmlstr)); - YAZ_CHECK(doc); - if (!doc) - return; + yaz_nfa *nfa=yaz_nfa_parse_xml_memory(xmlstr); +#if 0 +/* doesn't parse */ + YAZ_CHECK(nfa); +#endif +} + + + +/** \brief Test parsing of a minimal, invalid xml string */ +void test2() { + char *xmlstr=" " + " " + " foo " + " bar " + ""; + /* missing "" */ + yaz_log(YLOG_LOG,"Parsing bad xml, expecting errors:"); + yaz_nfa *nfa=yaz_nfa_parse_xml_memory(xmlstr); + YAZ_CHECK(!nfa); } + int main(int argc, char **argv) { YAZ_CHECK_INIT(argc, argv); + YAZ_CHECK_LOG(); nmem_init (); test1(); + test2(); nmem_exit (); YAZ_CHECK_TERM;