]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - tests/ctm-identity.lisp
feat: support basic XTM topic names (slice 21D)
[topic-maps.git] / tests / ctm-identity.lisp
index d1afb4de96498bd78e97ecfc2824130c3afa25d8..5601bca41d28ce6690771cf37529e3c3c61a1b98 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." "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 "identity-feature-boundary:a isa person."
+           (let ((map (read-text "a isa person.")))
+             (= 1 (length (topic-maps.tmdm:topic-map-associations map)))))
+    (dolist (text '("def tpl() a. end" "%include <other.ctm>"
+                    "? - \"anonymous\" ~r."  "a - \"\"\"triple\"\"\"."))
+      (check (if (search "%include" text) "identity:Include-requires-explicit-resolver"
+                 (concatenate 'string "identity-feature-boundary:" text))
+             (cond ((search "def " text) (null (topic-map-topics (read-text text))))
+                   ((search "%include" text)
+                    (handler-case (progn (read-text text) nil)
+                      (ctm-unsupported (c) (eq :resource-resolver-required (error-code c)))))
+                   ((find #\~ text) (typep (read-text text) 'topic-maps.tmdm:topic-map))
+                   (t (string= "triple" (topic-name-value (first (topic-names (first-topic (read-text text))))))))))
+    (check "scope-on-bare-topic-rejected"
+           (eq :unexpected-token (error-code (rejection "a @theme."))))
+    (check "scoped-name-now-deserialized"
+           (= 1 (length (topic-maps.tmdm:topic-name-scope
+                          (first (topic-names (first-topic (read-text "a - \"name\" @theme."))))))))
     (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"