X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fnfaxmltest1.c;h=296dd97496a0f3a95177c53d38829b4102c21bfb;hb=f83e5541f06bc5587efb2231006841137ba9f6d4;hp=04c26ee0da77fd95f5a93dab3975637a3dd5eb89;hpb=b9e447111828c6056c35b8a5f11a386e843edb59;p=yaz-moved-to-github.git diff --git a/test/nfaxmltest1.c b/test/nfaxmltest1.c index 04c26ee..296dd97 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.1 2006-07-05 08:12:48 heikki Exp $ + * $Id: nfaxmltest1.c,v 1.5 2006-07-07 07:14:30 adam Exp $ * */ @@ -13,10 +13,11 @@ #include #include -#if HAVE_XML2 +#if YAZ_HAVE_XML2 #include +/** \brief Test parsing of a minimal, valid xml string */ void test1() { char *xmlstr=" " " " @@ -24,18 +25,38 @@ 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() { + yaz_nfa *nfa; + char *xmlstr=" " + " " + " foo " + " bar " + ""; + /* missing "" */ + yaz_log(YLOG_LOG,"Parsing bad xml, expecting errors:"); + 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;