X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Fnfaxmltest1.c;h=38d48e31ccc45b9856833574bb10784fb4c5368d;hp=106c78d7dfdb7c55f2ee94f8a9b8b9a543d00e36;hb=fc42e0dc251df1d80ffc4c9279478d64d8a7027c;hpb=fc6d778b923000b5c6ad8e108b0b184178a9d33f diff --git a/test/nfaxmltest1.c b/test/nfaxmltest1.c index 106c78d..38d48e3 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.3 2006-07-06 13:10:31 heikki Exp $ * */ @@ -17,6 +17,7 @@ #include +/** \brief Test parsing of a minimal, valid xml string */ void test1() { char *xmlstr=" " " " @@ -24,18 +25,34 @@ void test1() { " bar " "" ""; - xmlDocPtr doc = xmlParseMemory(xmlstr, strlen(xmlstr)); - YAZ_CHECK(doc); - if (!doc) - return; + yaz_nfa *nfa=yaz_nfa_parse_xml_memory(xmlstr); + YAZ_CHECK(nfa); } + + +/** \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;