]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-22b/failure-controls.lisp
feat(tmdm): readers for the TMDM 7.2/7.3 relationships; tests for both default name...
[topic-maps.git] / reports / slice-22b / failure-controls.lisp
1 ;; Disposable executor controls for the one Slice-22B positive Case Record.
2 ;; Reuse the existing ASDF runner, public parser/reader and result classifier.
3 (require :asdf)
4 (assert (string= "2.5.4" (lisp-implementation-version)))
5 (setf *compile-verbose* nil *load-verbose* nil)
6 (asdf:load-asd (merge-pathnames "../../topic-maps.asd" *load-truename*))
7 (asdf:load-system "topic-maps/xtm/tests")
8 (let* ((target "xtm2/in/variant-duplicate-reifier2.xtm")
9 (mode (uiop:getenv "TOPIC_MAPS_22B_FAULT"))
10 (iri (concatenate 'string "https://xtm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/" target)))
11 (if (string= mode "mismatch")
12 (let ((saved (symbol-function 'topic-maps.cxtm:canonicalize-octets)))
13 (setf (symbol-function 'topic-maps.cxtm:canonicalize-octets)
14 (lambda (map &rest args)
15 (let ((actual (apply saved map args)))
16 (if (equal iri (getf args :base-locator))
17 (let ((changed (copy-seq actual))) (setf (aref changed 0) (logxor 1 (aref changed 0))) changed)
18 actual)))))
19 (let* ((saved (symbol-function 'topic-maps.xtm:deserialize-octets))
20 (source (cond
21 ((string= mode "xml") "<a><b></a>")
22 ((string= mode "xtm") (topic-maps.xtm.tests::document "<topic id='2bad'/>"))
23 ((string= mode "unsupported") (topic-maps.xtm.tests::document
24 "<topic id='a'><name><value>N</value><variant><scope><topicRef href='#s'/></scope><resourceData datatype='http://www.w3.org/2001/XMLSchema#integer'>42</resourceData></variant></name></topic>"))
25 ((string= mode "tmdm") (topic-maps.xtm.tests::document
26 "<topic id='a'><name><value>N</value><variant reifier='#r'><scope><topicRef href='#s'/></scope><resourceData>A</resourceData></variant><variant reifier='#r'><scope><topicRef href='#s'/></scope><resourceData>B</resourceData></variant></name></topic>"))
27 (t (error "Unknown Slice-22B executor fault ~S" mode)))))
28 (setf (symbol-function 'topic-maps.xtm:deserialize-octets)
29 (lambda (raw &rest args)
30 (apply saved (if (equal target (getf args :source-key)) (topic-maps.xtm.tests::bytes source) raw) args)))))
31 (asdf:test-system "topic-maps/xtm"))
32 (error "Fault injection did not cause the required ASDF failure.")