X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftst_retrieval.c;h=89ba159ff2d20a6f8ebd2030a60216605dcb739d;hp=cea9da06f81ffad54b4ebe0890076000f13cf218;hb=31216a13d9e767800206f612fd14c408357fdafd;hpb=d305f63028800611fd05a3bfc54db24e2634d7ad diff --git a/test/tst_retrieval.c b/test/tst_retrieval.c index cea9da0..89ba159 100644 --- a/test/tst_retrieval.c +++ b/test/tst_retrieval.c @@ -1,20 +1,18 @@ -/* - * Copyright (C) 2005-2006, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 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 #if HAVE_CONFIG_H #include #endif -#if HAVE_XSLT +#if YAZ_HAVE_XSLT #include #include @@ -74,12 +72,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 +96,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 +314,10 @@ static void tst_configure() int main(int argc, char **argv) { YAZ_CHECK_INIT(argc, argv); -#if HAVE_XSLT + + yaz_log_xml_errors(0, 0 /* disable it */); + +#if YAZ_HAVE_XSLT tst_configure(); #endif YAZ_CHECK_TERM; @@ -207,6 +326,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