Change K&R-style empty function declarations to explicit ANSI-C (void) prototypes
[yaz-moved-to-github.git] / test / tst_retrieval.c
index cea9da0..7a2561b 100644 (file)
@@ -2,19 +2,21 @@
  * Copyright (C) 2005-2006, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tst_retrieval.c,v 1.3 2006-05-07 14:48:25 adam Exp $
+ * $Id: tst_retrieval.c,v 1.7 2006-10-04 16:59:34 mike Exp $
  *
  */
 #include <yaz/retrieval.h>
 #include <yaz/test.h>
 #include <yaz/wrbuf.h>
 #include <string.h>
+#include <yaz/log.h>
+#include <yaz/libxml2_error.h>
 
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#if HAVE_XSLT
+#if YAZ_HAVE_XSLT
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
@@ -102,7 +104,7 @@ int conv_configure_test(const char *xmlstring, const char *expect_error,
     return ret;
 }
 
-static void tst_configure()
+static void tst_configure(void)
 {
     YAZ_CHECK(conv_configure_test("<bad", 
                                   "xmlParseMemory", 0));
@@ -117,10 +119,11 @@ static void tst_configure()
                                   " Expected 'retrieval'", 0));
 
     YAZ_CHECK(conv_configure_test("<retrievalinfo><retrieval/>"
-                                  "</retrievalinfo>", 0, 0));
+                                  "</retrievalinfo>", 
+                                  "Missing 'syntax' attribute", 0));
 
     YAZ_CHECK(conv_configure_test("<retrievalinfo>"
-                                  "<retrieval>\n"
+                                  "<retrieval syntax=\"usmarc\">\n"
                                   "  "
                                   "<convert>"
                                   "<xslt stylesheet=\"tst_record_conv.xsl\"/>"
@@ -136,7 +139,7 @@ static void tst_configure()
                                   0, 0));
 
     YAZ_CHECK(conv_configure_test("<retrievalinfo>"
-                                  "<retrieval>"
+                                  "<retrieval syntax=\"usmarc\">"
                                   "<convert>"
                                   "<xslt stylesheet=\"tst_record_conv.xsl\"/>"
                                   "<marc"
@@ -147,7 +150,7 @@ static void tst_configure()
                                   "/>"
                                   "</convert>"
                                   "</retrieval>"
-                                  "<retrieval>"
+                                  "<retrieval syntax=\"usmarc\">"
                                   "<convert>"
                                   "<xslt stylesheet=\"tst_record_conv.xsl\"/>"
                                   "<marc"
@@ -165,7 +168,7 @@ static void tst_configure()
     YAZ_CHECK(conv_configure_test("<retrievalinfo>"
                                   "<retrieval" 
                                   " syntax=\"usmarc\""
-                                  " schema=\"marcxml\"" 
+                                  " name=\"marcxml\"" 
                                   " identifier=\"info:srw/schema/1/marcxml-v1.1\""
                                   ">"
                                   "<convert/>"
@@ -175,6 +178,35 @@ static void tst_configure()
 
     YAZ_CHECK(conv_configure_test("<retrievalinfo>"
                                   "<retrieval" 
+                                  " syntax=\"usmarc\""
+                                  " name=\"marcxml\""
+                                  " backendsyntax=\"usmarc\""
+                                  " backendname=\"marcxml\""
+                                  " identifier=\"info:srw/schema/1/marcxml-v1.1\""
+                                  ">"
+                                  "<convert/>"
+                                  "</retrieval>"
+                                  "</retrievalinfo>",
+                                  0, 0));
+
+    YAZ_CHECK(conv_configure_test("<retrievalinfo>"
+                                  "<retrieval" 
+                                  " syntax=\"usmarc\""
+                                  " name=\"marcxml\""
+                                  " backendsyntax=\"usmarc\""
+                                  " backendschema=\"marcxml\""
+                                  " identifier=\"info:srw/schema/1/marcxml-v1.1\""
+                                  ">"
+                                  "<convert/>"
+                                  "</retrieval>"
+                                  "</retrievalinfo>",
+                                  "Bad attribute 'backendschema'."
+                                  " Use 'backendname' instead", 
+                                  0));
+
+
+    YAZ_CHECK(conv_configure_test("<retrievalinfo>"
+                                  "<retrieval" 
                                   " syntax=\"unknown_synt\""
                                   ">"
                                   "<convert/>"
@@ -198,7 +230,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;