X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftst_retrieval.c;h=6ef554f318cb22f7f7c2a796deb22abe58c49110;hb=30be9a32fd26a2d08aa4413942408500c93ad4a3;hp=cea9da06f81ffad54b4ebe0890076000f13cf218;hpb=d305f63028800611fd05a3bfc54db24e2634d7ad;p=yaz-moved-to-github.git diff --git a/test/tst_retrieval.c b/test/tst_retrieval.c index cea9da0..6ef554f 100644 --- a/test/tst_retrieval.c +++ b/test/tst_retrieval.c @@ -1,20 +1,19 @@ -/* - * Copyright (C) 2005-2006, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2009 Index Data * See the file LICENSE for details. - * - * $Id: tst_retrieval.c,v 1.3 2006-05-07 14:48:25 adam Exp $ - * */ #include #include #include #include +#include +#include #if HAVE_CONFIG_H #include #endif -#if HAVE_XSLT +#if YAZ_HAVE_XSLT #include #include @@ -74,12 +73,12 @@ int conv_configure_test(const char *xmlstring, const char *expect_error, if (!p) { - if (expect_error && !strcmp(wrbuf_buf(w), expect_error)) + if (expect_error && !strcmp(wrbuf_cstr(w), expect_error)) ret = 1; else { ret = 0; - printf("%.*s\n", wrbuf_len(w), wrbuf_buf(w)); + printf("%s\n", wrbuf_cstr(w)); } } else @@ -98,57 +97,175 @@ int conv_configure_test(const char *xmlstring, const char *expect_error, ret = 1; } } - wrbuf_free(w, 1); + wrbuf_destroy(w); return ret; } -static void tst_configure() +static void tst_configure(void) { YAZ_CHECK(conv_configure_test("", - "Missing 'retrievalinfo' element", 0)); + "Expected element ", 0)); YAZ_CHECK(conv_configure_test("", 0, 0)); YAZ_CHECK(conv_configure_test("", - "Bad element 'bad'." - " Expected 'retrieval'", 0)); + "Element :" + " expected element , got ", + 0)); YAZ_CHECK(conv_configure_test("" - "", 0, 0)); + "", + "Missing 'syntax' attribute", 0)); + + + YAZ_CHECK(conv_configure_test("" + "" + "" + "", + "Element : expected attributes " + "'syntax', identifier' or 'name', got " + "'unknown'", 0)); + + YAZ_CHECK(conv_configure_test("" + "" + "" + "", + "Element : unknown attribute " + "value syntax='unknown_synt'", 0)); + + YAZ_CHECK(conv_configure_test("" + "" + "", + 0, 0)); + + YAZ_CHECK(conv_configure_test("" + "" + "", + 0, 0)); + + + YAZ_CHECK(conv_configure_test("" + "" + "", + 0, 0)); + + + + YAZ_CHECK(conv_configure_test("" + "" + "" + "" + "", + "Element : expected zero or one element " + ", got ", 0)); + + YAZ_CHECK(conv_configure_test("" + "" + " " + "" + "", + "Element : expected attributes 'syntax' or 'name," + " got 'schema'", 0)); + + YAZ_CHECK(conv_configure_test("" + "" + " " + "" + "", + 0, 0)); + + YAZ_CHECK(conv_configure_test("" + "" + " " + "" + "", + "Element : " + "attribute 'syntax' has invalid value " + "'unknown'", 0)); + + + YAZ_CHECK(conv_configure_test("" + "" + " " + "" + "", + "Element : expected attributes " + "'syntax' or 'name, got 'unknown'", 0)); + YAZ_CHECK(conv_configure_test("" - "\n" - " " - "" + "" + "" "" "" - "" + "" "" "", - 0, 0)); + "Element : Unsupported character" + " set mapping defined by attribute values", 0)); YAZ_CHECK(conv_configure_test("" - "" - "" + "" + "" "" "" - "" + "" "" - "" - "" + "", + "Element : Unsupported" + " input format defined by attribute value", 0)); + + YAZ_CHECK(conv_configure_test("" + "" + "" "" "" - "" + "" "" "", 0, 0)); - - YAZ_CHECK(conv_configure_test("" - "" - "" + YAZ_CHECK(conv_configure_test( + "" + "" + "" + "" + "" + " " + " " + " " "" - "", - 0, 0)); - - YAZ_CHECK(conv_configure_test("" - "" - "" + "" + " " + " " + " " "" - "", - "Bad syntax 'unknown_synt'", 0)); - - YAZ_CHECK(conv_configure_test("" - "" - "" + "" + " " + " " + " " + " " "" "", - "Bad backendsyntax 'unknown_synt'", 0)); + 0, 0)); } @@ -198,7 +315,10 @@ static void tst_configure() int main(int argc, char **argv) { YAZ_CHECK_INIT(argc, argv); -#if HAVE_XSLT + + libxml2_error_to_yazlog(0 /* disable it */, ""); + +#if YAZ_HAVE_XSLT tst_configure(); #endif YAZ_CHECK_TERM; @@ -207,6 +327,7 @@ int main(int argc, char **argv) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab