2 (assert (string= "2.5.4" (lisp-implementation-version)))
3 (setf *compile-verbose* nil *load-verbose* nil)
4 (asdf:load-asd "/Users/rgb/workspace/topic-maps/topic-maps.asd")
5 (asdf:test-system "topic-maps/xtm")
6 (topic-maps.xtm.tests:write-report "/private/tmp/xtm-slice-21c-uvb60rqn/baseline-xtm.json")
7 (in-package :topic-maps.xtm.tests)
8 (defun observation-condition (c)
10 (let* ((xtm (typep c 'topic-maps.xtm:xtm-error))
11 (code (cond (xtm (error-code c)) ((typep c 'item-identifier-error) (item-identifier-error-code c)))))
12 (topic-maps.test-foundation::fields
13 "class" (string (type-of c)) "code" (when code (string-downcase (string code)))
14 "detail" (cond (xtm (topic-maps.xtm:error-detail c))
15 ((typep c 'item-identifier-error) (topic-maps.tmdm::item-identifier-error-detail c)))
16 "message" (princ-to-string c) "line" (when xtm (error-line c)) "column" (when xtm (error-column c))
17 "positionUnit" (when xtm "approximate-SAX-line-column")
18 "documentIRI" (when xtm (error-document-iri c)) "sourceKey" (when xtm (error-source-key c))
19 "cause" (when (typep c 'xtm-xml-error) (observation-condition (topic-maps.xtm:error-cause c)))))))
21 (dolist (name '("id-invalid" "itemid-collision" "no-version" "reifier-elem-in-2.0" "subjid-ref-in-2.0" "subjloc-ref-in-2.0" "topic-no-id"))
22 (let* ((id (format nil "xtm2/invalid/~A.xtm" name))
23 (iri (concatenate 'string "https://xtm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/" id))
24 (raw (file-bytes (corpus-path id)))
25 (xml (topic-maps.xml:parse-octets raw (make-instance 'topic-maps.xtm::source-handler)))
26 (c (condition-from (lambda () (deserialize-octets raw :document-iri iri :source-key id)))))
28 (push (topic-maps.test-foundation::fields "id" id "documentIRI" iri "sourceBytes" (length raw)
29 "sourceHex" (format nil "~{~2,'0X~}" (coerce raw 'list))
30 "sourceText" (babel:octets-to-string raw :encoding :utf-8)
31 "xmlWellFormed" :true "condition" (observation-condition c)) rows)))
32 (with-open-file (out "/private/tmp/xtm-slice-21c-uvb60rqn/observed-before-registration.json" :direction :output :if-exists :supersede)
33 (topic-maps.test-foundation::emit-json-value (coerce (nreverse rows) 'vector) out) (terpri out)))
34 (assert (not (find-package :topic-maps.ctm)))