Implement yaz_retrieval_configure.
[yaz-moved-to-github.git] / test / tst_record_conv.c
index 2b414c6..c6d9ac0 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 2005-2006, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: tst_record_conv.c,v 1.2 2006-05-03 13:04:46 adam Exp $
+ * $Id: tst_record_conv.c,v 1.5 2006-05-05 18:37:08 adam Exp $
  *
  */
 #include <yaz/record_conv.h>
 #include <yaz/wrbuf.h>
 #include <string.h>
 
-#if HAVE_XML2
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#if HAVE_XSLT
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
@@ -87,13 +91,14 @@ int conv_configure_test(const char *xmlstring, const char *expect_error,
         }
         else
         {
-            if (pt)
-                *pt = p;
-            else
-                yaz_record_conv_destroy(p);
             ret = 1;
         }
     }
+    if (pt)
+        *pt = p;
+    else
+        yaz_record_conv_destroy(p);
+
     wrbuf_free(w, 1);
     return ret;
 }
@@ -214,6 +219,7 @@ static void tst_convert()
                                   "</convert>",
                                   0, &p));
     YAZ_CHECK(conv_convert_test(p, marcxml_rec, iso2709_rec));
+    yaz_record_conv_destroy(p);
 
     YAZ_CHECK(conv_configure_test("<convert>"
                                   "<marc"
@@ -225,6 +231,7 @@ static void tst_convert()
                                   "</convert>",
                                   0, &p));
     YAZ_CHECK(conv_convert_test(p, iso2709_rec, marcxml_rec));
+    yaz_record_conv_destroy(p);
 
 
     YAZ_CHECK(conv_configure_test("<convert>"
@@ -245,7 +252,7 @@ static void tst_convert()
                                   "</convert>",
                                   0, &p));
     YAZ_CHECK(conv_convert_test(p, marcxml_rec, marcxml_rec));
-
+    yaz_record_conv_destroy(p);
 
 
     YAZ_CHECK(conv_configure_test("<convert>"
@@ -264,7 +271,7 @@ static void tst_convert()
                                   "</convert>",
                                   0, &p));
     YAZ_CHECK(conv_convert_test(p, marcxml_rec, marcxml_rec));
-
+    yaz_record_conv_destroy(p);
 }
 
 #endif
@@ -272,7 +279,7 @@ static void tst_convert()
 int main(int argc, char **argv)
 {
     YAZ_CHECK_INIT(argc, argv);
-#if HAVE_XML2
+#if HAVE_XSLT
     tst_configure();
     tst_convert();
 #endif