]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - tests/ctm-prefixes.lisp
Qualify pinned CXML encodings with reproducible local patches
[topic-maps.git] / tests / ctm-prefixes.lisp
index d5977c7cc1aba5a8e5f252188e39a5cca9fa6dee..7a00af4916df6e90c3459980d4bc5b118a5549e5 100644 (file)
                     (= 1 (error-line c)) (= (1+ position) (error-column c)))))))
   (let ((c (ctm-condition (format nil "%prefix ex <urn:one:>~C~C%prefix ex <urn:two:>" #\Return #\Newline))))
     (check "prefix-collision-crlf-location" (and (typep c 'topic-maps.ctm:prefix-collision) (= 2 (error-line c)) (= 9 (error-column c)))))
-  (dolist (text '("%include <other.ctm>" "%version 1.0" "%prefix ex <urn:ex:> a - ex:type: \"Name\"."))
-    (check (concatenate 'string "remaining-construct-unsupported:" text) (typep (ctm-condition text) 'ctm-unsupported))))
+  (dolist (text '("%include <other.ctm>" "%version 1.0"))
+    (check (if (search "%include" text) "prefix:Include-requires-explicit-resolver"
+               (concatenate 'string "remaining-construct-unsupported:" text))
+           (let ((c (ctm-condition text)))
+             (and (typep c 'ctm-unsupported)
+                  (or (not (search "%include" text)) (eq :resource-resolver-required (error-code c)))))))
+  (let* ((map (read-text "%prefix ex <urn:ex:> a - ex:type: \"Name\"."))
+         (name (first (topic-names (first-topic map)))))
+    (check "prefix-qname-name-type-supported"
+           (equal '("urn:ex:type") (topic-subject-identifiers (topic-name-type name))))))
+
 
 (defun explicit-datatype-tests ()
   (dolist (datatype '("urn:datatype:custom" "http://example.org/types/custom" "http://www.w3.org/2001/XMLSchema#string"))
     (check "explicit-anyuri-cxtm-locator-rule" (search "<value>#z</value>" (cxtm map))))
   (dolist (name '("integer" "decimal" "date" "dateTime"))
     (let* ((dt (concatenate 'string "http://www.w3.org/2001/XMLSchema#" name))
-           (value (if (equal name "date") "2000-01-01" "00042"))
+           (value (cond ((equal name "date") "2000-01-01") ((equal name "dateTime") "2000-01-01T00:00:00.1200Z") (t "00042")))
            (map (read-text (format nil "a t:\"~A\"^^<~A>." value dt))) (o (first (all-occurrences map)))
            (state (map-state map)) (c (cxtm-condition (lambda () (cxtm map)))))
       (check (concatenate 'string "excluded-normalization-model-preserves:" name)
              (and (string= dt (topic-maps.tmdm:occurrence-datatype o)) (string= value (topic-maps.tmdm:occurrence-value o))))
-      (if (member name '("integer" "decimal" "date") :test #'string=)
-          (check (concatenate 'string name "-explicit-cxtm-now-supported")
-                 (and (null c) (search (cond ((string= name "integer") "<value>42</value>") ((string= name "decimal") "<value>42.0</value>") (t "<value>2000-01-01</value>"))
-                                       (cxtm map)) (equal state (map-state map))))
-          (check (concatenate 'string "excluded-normalization-explicit-cxtm-unsupported:" name)
-                 (and (typep c 'topic-maps.cxtm:cxtm-unsupported) (eq :unsupported-occurrence-datatype (topic-maps.cxtm:error-code c)) (equal state (map-state map)))))))
+      (check (concatenate 'string name "-explicit-cxtm-now-supported")
+             (and (null c) (search (cond ((string= name "integer") "<value>42</value>")
+                                        ((string= name "decimal") "<value>42.0</value>")
+                                        ((string= name "dateTime") "<value>2000-01-01T00:00:00.12Z</value>")
+                                        (t "<value>2000-01-01</value>")) (cxtm map))
+                  (equal state (map-state map))))))
   (let* ((map (read-text "%prefix xsd <http://www.w3.org/2001/XMLSchema#> a t:\"Same\"; t:\"Same\"^^xsd:string.")))
     (check "implicit-explicit-string-datatypes-have-identical-equality" (= 1 (length (all-occurrences map)))))
   (let* ((value (concatenate 'string "<&>" (map 'string #'code-char '(101 769))))