]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - tests/ctm-identity.lisp
Implement Date Occurrences with lexical validation and CXTM canonicalization
[topic-maps.git] / tests / ctm-identity.lisp
index 2d8b98c72e0eb3da6346c01213c8aa9d057bfb71..2c6d6e48cfeed8fda2fab775630943b4c7ed0e0a 100644 (file)
     (let ((condition (rejection (format nil "a.~%  ex:fake."))))
       (check "undefined-prefix-condition-class" (typep condition 'undefined-prefix))
       (check "error-line-column" (and (= 2 (error-line condition)) (= 3 (error-column condition)))))
-    (dolist (text '("a isa person." "relation(role: a)" "def tpl() a. end" "%prefix ex https://example.invalid/ ex:a."
+    (dolist (text '("a isa person." "def tpl() a. end" "%include <other.ctm>"
                     "? - \"anonymous\"." "a @theme." "a - \"name\" @theme." "a - \"\"\"triple\"\"\"."))
       (check (concatenate 'string "unsupported-not-silently-accepted:" text) (unsupported-p text)))
+    (check "association-now-deserialized"
+           (= 1 (length (topic-maps.tmdm:topic-map-associations (read-text "relation(role: a)")))))
     (check "empty-document-has-no-accidental-type-topic"
            (null (topic-map-topics (read-text ""))))
     (let ((map (deserialize-file (asdf:system-relative-pathname "topic-maps" "tests/fixtures/ctm/utf8-bom.ctm")
            (eq :expected-name-value (error-code (rejection "a - type:."))))
     (check "typed-name-layout-remains-unsupported"
            (unsupported-p (format nil "a - type:~%#( layout )# \"Name\".")))
-    (check "additional-identity-explicitly-unsupported" (unsupported-p "a <https://example.invalid/alias>."))
+    (check "additional-identity-now-deserialized"
+           (let* ((map (read-text "a <https://example.invalid/alias>.")) (topic (first-topic map)))
+             (and (= 1 (length (topic-map-topics map)))
+                  (equal (topic-subject-identifiers topic) '("https://example.invalid/alias"))
+                  (equal (topic-item-identifiers topic) '("https://example.invalid/a/doc.ctm#a")))))
     (dolist (ending (list (string #\Return) (format nil "~C~C" #\Return #\Newline)))
       (let ((condition (rejection (concatenate 'string "a." ending "ex:fake."))))
         (check (if (= 1 (length ending)) "cr-error-line" "crlf-error-line")
              (equal (topic-subject-identifiers
                      (first-topic (read-text (format nil "<~A>." (first pair)) "http://a/b/c/d;p?q")))
                     (list (second pair)))))
-    (check "canonicalizer-not-defined" (null (asdf:find-system "topic-maps/cxtm" nil)))
+    (check "reader-does-not-depend-on-canonicalizer"
+           (equal (asdf:system-depends-on (asdf:find-system "topic-maps/ctm"))
+                  '("topic-maps/tmdm")))
     (setf *last-checks* (nreverse *checks*))
     (format t "~&CTM-IDENTITY-SEMANTICS-PASS: ~D checks, 5 imported semantic cases, required prefix rejection; no CXTM equality passes.~%"
             (length *last-checks*))