X-Git-Url: https://dreyeck.freedombox.rocks/gitweb/topic-maps.git/blobdiff_plain/034d2c14fbf6a58a062351e4b64680283d241d22..acc9eb65b0cce71409ad84841f082f5ca125c839:/tests/xtm-variants.lisp diff --git a/tests/xtm-variants.lisp b/tests/xtm-variants.lisp index af323b6..76e8f52 100644 --- a/tests/xtm-variants.lisp +++ b/tests/xtm-variants.lisp @@ -38,7 +38,7 @@ (topic-maps.test-foundation::fields "value" (variant-value v) "datatype" (variant-datatype v) "parentName" (1+ (position (variant-parent v) names :test #'eq)) "scope" (coerce (mapcar (lambda (theme) (1+ (position theme topics :test #'eq))) (variant-scope v)) 'vector) - "itemIdentifiers" (coerce (item-identifiers v) 'vector) "reifier" nil)) 'vector)))) + "itemIdentifiers" (coerce (item-identifiers v) 'vector) "reifier" (when (item-reifier v) (1+ (position (item-reifier v) topics :test #'eq))))) 'vector)))) (defun variant-original-model-checks (spec map raw) (destructuring-bind (id count name-scope-ids variant-scope-ids source-count) spec @@ -222,11 +222,11 @@ (and (scope-eq-p (variant-scope (first (all-variants map))) (list (by-id map "s"))) (same-identifiers-p (item-identifiers (by-id map "s")) (append (list (concatenate 'string *document* "#s")) (when (equal kind "itemIdentity") '("https://themes.invalid/map#theme")))))))))) -(defun variant-merge-controls () +(defun variant-merge-controls (&optional (literal (lambda (themes) (variant-xml "V" themes))) (prefix "variant-merge:") verify) (dolist (target '("parent" "variant-theme" "name-theme")) (dolist (kind '("subjectIdentifier" "subjectLocator" "itemIdentity")) - (let* ((label (format nil "variant-merge:~A:~A" target kind)) (old-names nil) (old-variants nil) (old-themes nil) - (first-v (variant-xml "V" '("extra"))) (second-v first-v) (body nil) (*name-controls* nil)) + (let* ((label (format nil "~A~A:~A" prefix target kind)) (old-names nil) (old-variants nil) (old-themes nil) + (first-v (funcall literal '("extra"))) (second-v first-v) (body nil) (*name-controls* nil)) (labels ((topic-source (id locator content) (format nil "~A~A" id (if (equal kind "itemIdentity") "" (format nil "<~A href='~A'/>" kind locator)) content)) @@ -243,7 +243,7 @@ ((equal target "variant-theme") (concatenate 'string (format nil "~A" (variant-name-xml '("base") - (concatenate 'string (variant-xml "V" '("x")) (variant-xml "V" '("y"))) "urn:n1")) + (concatenate 'string (funcall literal '("x")) (funcall literal '("y"))) "urn:n1")) (topic-source "x" "urn:one" "") (topic-source "y" "urn:two" "") (bridge "x" "y"))) (t (concatenate 'string (format nil "~A~A" @@ -280,6 +280,7 @@ (if (equal target "variant-theme") '("urn:n1") '("urn:n1" "urn:n2"))) (variants-current-p map))) (topic-maps.cxtm:canonicalize-octets map :base-locator *document*) + (when verify (funcall verify label map)) (check (concatenate 'string label ":cxtm-pure-retains-handles") (equal before (variant-state map))) (push (topic-maps.test-foundation::fields "label" label "kind" "staged-native-reader-control" "sourceText" (document body) "model" (variant-model-data map)) *variant-controls*))))))))) @@ -332,11 +333,11 @@ ("bad-href" "V" :invalid-topic-ref) ("resourceRef-missing-href" "" :missing-attribute))) (variant-error-control (first row) (format nil "N~A" (second row)) 'xtm-rejection (third row))) - (dolist (row '(("resourceRef" "" :unsupported-construct) - ("itemIdentity" "V" :unsupported-construct) - ("reifier" "V" :reification) - ("datatype" "V" :resource-data-datatype) - ("embedded-XML" "V" :resource-data-markup))) + (dolist (row '(("resourceData-anyType" "42" :resource-data-datatype) + ("reified-itemIdentity-excluded-datatype" "42" :resource-data-datatype) + ("reifier-excluded-datatype" "42" :resource-data-datatype) + ("datatype" "V" :resource-data-datatype) + ("embedded-XML" "V" :resource-data-datatype))) (variant-error-control (first row) (format nil "N~A" (second row)) 'xtm-unsupported (third row)))) (defun variant-tests ()