|
@@ -17,7 +17,8 @@ test_namespace()
|
|
|
EXPECT_STR_EQ (
|
|
|
LSUP_nsmap_get_ns (nsm, "dcterms"), "http://purl.org/dc/terms/");
|
|
|
// Prefixes longer than 7 chars are truncated.
|
|
|
- ASSERT (LSUP_nsmap_get_ns (nsm, "dctermsxx"), "http://purl.org/dc/terms/");
|
|
|
+ EXPECT_STR_EQ (
|
|
|
+ LSUP_nsmap_get_ns (nsm, "dctermsxx"), "http://purl.org/dc/terms/");
|
|
|
ASSERT (LSUP_nsmap_get_ns (nsm, "none") == NULL, "Non-existent NS found!");
|
|
|
|
|
|
// Lookup NS.
|
|
@@ -36,6 +37,25 @@ test_namespace()
|
|
|
fq_uri = NULL;
|
|
|
EXPECT_PASS (LSUP_nsmap_normalize_uri (nsm, pfx_uri, &fq_uri));
|
|
|
EXPECT_STR_EQ (fq_uri, "http://purl.org/dc/elements/1.1/title");
|
|
|
+ free (fq_uri);
|
|
|
+
|
|
|
+ ASSERT (
|
|
|
+ LSUP_nsmap_normalize_uri (nsm, "dctermsxxtitle", &fq_uri)
|
|
|
+ == LSUP_NORESULT, "Wrong RC for normalizing long ns!");
|
|
|
+ EXPECT_STR_EQ (fq_uri, "dctermsxxtitle");
|
|
|
+ free (fq_uri);
|
|
|
+
|
|
|
+ ASSERT (
|
|
|
+ LSUP_nsmap_normalize_uri (nsm, "bogus:ns:123", &fq_uri)
|
|
|
+ == LSUP_NORESULT, "Wrong RC for normalizing non-existent ns!");
|
|
|
+ EXPECT_STR_EQ (fq_uri, "bogus:ns:123");
|
|
|
+ free (fq_uri);
|
|
|
+
|
|
|
+ ASSERT (
|
|
|
+ LSUP_nsmap_normalize_uri (nsm, "bogus", &fq_uri)
|
|
|
+ == LSUP_NORESULT, "Wrong RC for normalizing non-prefixed URI!");
|
|
|
+ EXPECT_STR_EQ (fq_uri, "bogus");
|
|
|
+ free (fq_uri);
|
|
|
|
|
|
EXPECT_PASS (LSUP_nsmap_remove (nsm, "dc"));
|
|
|
ASSERT (
|
|
@@ -44,7 +64,6 @@ test_namespace()
|
|
|
ASSERT (LSUP_nsmap_get_ns (nsm, "dc") == NULL, "Deleted NS found!");
|
|
|
|
|
|
LSUP_nsmap_free (nsm);
|
|
|
- free (fq_uri);
|
|
|
free (pfx_uri);
|
|
|
|
|
|
return 0;
|