]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - tests/xtm-names.lisp
Document normative conformance decisions for Slice 22C
[topic-maps.git] / tests / xtm-names.lisp
1 (in-package #:topic-maps.xtm.tests)
2
3 (defparameter *name-original-specs*
4 '(("name" 2 (("topic" "Topic" :default)))
5 ("name-unicode" 2 (("topic" "馬籠" :default)))
6 ("name-escaping" 2 (("att" "<AT&T>" :default)))
7 ("name-duplicate" 2 (("topic" "Topic" :default)))
8 ("name-duplicate-merge" 2 (("topic" "Topics" "plural")))
9 ("merge-itemid-with-names" 2 (("topic" "Topics" :default) ("topic" "Topics 2" :default)))
10 ("name-type" 2 (("topic" "Topics" (:ii "http://psi.ontopia.net/xtm/basename/#plural"))))
11 ("name-type-before" 2 (("topic" "Topics" :default)))
12 ("name-type-after" 2 (("topic" "Topics" :default)))
13 ("name-type-after-bad" 3 (("topic" "Topics" :default) ("other" "Other" :default)))))
14
15 (defun names-current-p (map)
16 (and (references-current-p map)
17 (every (lambda (topic)
18 (every (lambda (name)
19 (and (eq name (canonical-topic-name name)) (eq topic (topic-name-parent name))
20 (eq (topic-name-type name) (canonical-topic (topic-name-type name)))
21 (member (topic-name-type name) (topic-map-topics map) :test #'eq)
22 (every (lambda (theme) (and (eq theme (canonical-topic theme))
23 (member theme (topic-map-topics map) :test #'eq))) (topic-name-scope name))))
24 (topic-names topic))) (topic-map-topics map))))
25
26 (defun name-state (map)
27 (list (public-state map)
28 (loop for topic in (topic-map-topics map) append
29 (loop for name in (topic-names topic) collect
30 (list name (topic-name-value name) (topic-name-type name) (topic-name-parent name)
31 (topic-name-scope name) (topic-name-variants name) (item-identifiers name)
32 (item-reifier name) (topic-maps.tmdm::%topic-name-forward name))))))
33
34 (defun name-model-data (map)
35 (flet ((fields (&rest args) (apply #'topic-maps.test-foundation::fields args)))
36 (let ((topics (topic-map-topics map)))
37 (labels ((ref (topic) (1+ (position topic topics :test #'eq))))
38 (fields "identity" (original-model-data map) "mapItemIdentifiers" (coerce (item-identifiers map) 'vector)
39 "canonicalNameParentTypeReferences" (if (names-current-p map) :true :false)
40 "names" (coerce (loop for topic in topics append
41 (loop for name in (topic-names topic) collect
42 (fields "value" (topic-name-value name) "parent" (ref (topic-name-parent name))
43 "type" (ref (topic-name-type name)) "scope" (coerce (mapcar #'ref (topic-name-scope name)) 'vector)
44 "itemIdentifiers" (coerce (item-identifiers name) 'vector)
45 "variantCount" (length (topic-name-variants name))))) 'vector))))))
46
47 (defun name-original-model-checks (spec map)
48 (let ((label (concatenate 'string "name-original:" (first spec)))
49 (expected (third spec)))
50 (check (concatenate 'string label ":topic-and-name-counts")
51 (and (= (second spec) (length (topic-map-topics map))) (null (topic-map-associations map))
52 (= (length expected) (loop for topic in (topic-map-topics map) sum (length (topic-names topic))))))
53 (check (concatenate 'string label ":canonical-parent-type-eq") (names-current-p map))
54 (dolist (row expected)
55 (destructuring-bind (owner-id value type-key) row
56 (let* ((owner (by-id map owner-id))
57 (type (cond ((eq type-key :default) (by-si map (default-name-type-identifier)))
58 ((stringp type-key) (by-id map type-key))
59 (t (find-if (lambda (topic) (member (second type-key) (topic-item-identifiers topic) :test #'equal)) (topic-map-topics map))))))
60 (check (format nil "~A:value-parent-type:~A:~A" label owner-id value)
61 (and owner type (find-if (lambda (name)
62 (and (equal value (topic-name-value name)) (eq owner (topic-name-parent name))
63 (eq type (topic-name-type name)) (eq name (canonical-topic-name name)))) (topic-names owner)))))))
64 (check (concatenate 'string label ":excluded-name-properties-empty")
65 (every (lambda (topic) (every (lambda (name)
66 (and (null (topic-name-scope name)) (null (topic-name-variants name))
67 (null (item-identifiers name)) (null (item-reifier name)))) (topic-names topic))) (topic-map-topics map)))
68 (check (concatenate 'string label ":one-default-type-if-used")
69 (= (if (find :default expected :key #'third) 1 0)
70 (count-if (lambda (topic) (member (default-name-type-identifier) (topic-subject-identifiers topic) :test #'equal)) (topic-map-topics map))))
71 (when (member (first spec) '("name-type-before" "name-type-after" "name-type-after-bad") :test #'equal)
72 (check (concatenate 'string label ":declared-default-type-eq")
73 (eq (by-id map "nametype") (by-si map (default-name-type-identifier)))))
74 (when (equal (first spec) "name-duplicate-merge")
75 (check (concatenate 'string label ":forward-type-merge-eq") (eq (by-id map "plural") (by-id map "flertall"))))
76 (when (equal (first spec) "merge-itemid-with-names")
77 (check (concatenate 'string label ":merged-parent-eq-and-identifiers")
78 (and (eq (by-id map "topic") (by-id map "topic2"))
79 (same-identifiers-p (list (concatenate 'string *document* "#topic")
80 (concatenate 'string *document* "#topic2") "http://example.org/#topic") (topic-item-identifiers (by-id map "topic"))))))))
81
82 (defun name-original-contracts ()
83 (setf *name-outputs* nil)
84 (dolist (spec *name-original-specs*)
85 (let* ((name (first spec)) (id (format nil "xtm2/in/~A.xtm" name))
86 (*document* (concatenate 'string "https://xtm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/" id))
87 (source (corpus-path id)) (baseline (corpus-path (format nil "xtm2/baseline/~A.xtm.cxtm" name)))
88 (raw (file-bytes source)) (copy (copy-seq raw)) (expected (file-bytes baseline))
89 (case (topic-maps.test-foundation:make-test-case :id id :category :valid :source-pathname source
90 :document-iri *document* :expected-outcome :cxtm-equal :expected-baseline baseline
91 :clauses '("XTM 2.0 4.2,4.10,4.11,4.14,4.20" "TMDM 5.4,6.2,6.3" "CXTM 3,4")))
92 (map nil) (actual nil) (c nil) (before nil))
93 (setf *cases* (append *cases* (list case)))
94 (handler-case (setf map (deserialize-octets raw :document-iri *document* :source-key id)
95 before (name-state map)
96 actual (topic-maps.cxtm:canonicalize-octets map :base-locator *document*))
97 (error (condition) (setf c condition)))
98 ;; A reader or model failure can never satisfy this positive contract.
99 (when (null c)
100 (handler-case (name-original-model-checks spec map) (error (condition) (setf c condition))))
101 (record-original-result case actual expected c)
102 (push (topic-maps.test-foundation::fields "id" id "documentIRI" *document* "sourceKey" id
103 "sourceBytes" (length raw) "sourceHex" (format nil "~{~2,'0X~}" (coerce raw 'list))
104 "sourceText" (babel:octets-to-string raw :encoding :utf-8)
105 "actualCXTM" (when actual (babel:octets-to-string actual :encoding :utf-8))
106 "expectedCXTM" (babel:octets-to-string expected :encoding :utf-8)
107 "actualBytes" (when actual (length actual)) "expectedBytes" (length expected)
108 "firstDifferentByte" (when actual (mismatch actual expected))
109 "condition" (negative-condition-data c) "model" (when map (name-model-data map))
110 "status" (string-downcase (string (topic-maps.test-foundation:test-case-status case)))) *name-outputs*)
111 (when c (error c))
112 (check (concatenate 'string "name-original:" name ":byte-exact") (equalp actual expected))
113 (check (concatenate 'string "name-original:" name ":source-preserved") (equalp raw copy))
114 (check (concatenate 'string "name-original:" name ":pure") (equal before (name-state map)))
115 (check (concatenate 'string "name-original:" name ":deterministic")
116 (equalp actual (topic-maps.cxtm:canonicalize-octets map :base-locator *document*)))
117 (check (concatenate 'string "name-original:" name ":repeat-pure") (equal before (name-state map)))
118 (let ((other (deserialize-octets raw :document-iri *document* :source-key "different-name-provenance")))
119 (check (concatenate 'string "name-original:" name ":source-key-only-provenance")
120 (and (equalp (name-model-data map) (name-model-data other))
121 (equalp actual (topic-maps.cxtm:canonicalize-octets other :base-locator *document*)))))))
122 (setf *name-outputs* (nreverse *name-outputs*))
123 (check "name-originals:43-unique-case-records"
124 (and (= 43 (length *cases*)) (= 36 (count :valid *cases* :key #'topic-maps.test-foundation:test-case-category))
125 (= 43 (length (remove-duplicates *cases* :key #'topic-maps.test-foundation:test-case-id :test #'equal))))))
126
127 (defun name-control (label body verify)
128 (let* ((map (read-body body)) (before (name-state map)))
129 (funcall verify map)
130 (check (concatenate 'string "name-control:" label ":canonical-references") (names-current-p map))
131 (let ((actual (topic-maps.cxtm:canonicalize-octets map :base-locator *document*)))
132 (check (concatenate 'string "name-control:" label ":pure") (equal before (name-state map)))
133 (push (topic-maps.test-foundation::fields "label" label "kind" "positive-XTM"
134 "sourceText" (document body) "model" (name-model-data map)
135 "actualCXTM" (babel:octets-to-string actual :encoding :utf-8)) *name-controls*))
136 map))
137
138 (defun name-error-control (label body class code)
139 (let* ((source (document body)) (key (concatenate 'string "name-syntax:" label))
140 (c (condition-from (lambda () (deserialize-octets (bytes source) :document-iri *document* :source-key key)))))
141 (check (concatenate 'string key ":class-code") (and (eq class (type-of c)) (eq code (error-code c))))
142 (check (concatenate 'string key ":context-position")
143 (and (equal *document* (error-document-iri c)) (equal key (error-source-key c))
144 (integerp (error-line c)) (plusp (error-line c)) (integerp (error-column c)) (plusp (error-column c))))
145 (push (topic-maps.test-foundation::fields "label" label "kind" "negative-or-unsupported-XTM"
146 "sourceText" source "condition" (negative-condition-data c)) *name-controls*)))
147
148 (defun name-text-controls ()
149 (dolist (row (list (list "simple" "Topic" "Topic") (list "empty" "" "")
150 (list "unicode" "馬籠🦊é" "馬籠🦊é")
151 (list "escaping-once" "&amp;lt; &lt; &amp; &#x1F98A;" "&lt; < & 🦊")
152 (list "whitespace" (format nil " A~C B~%C " #\Tab) (format nil " A~C B~%C " #\Tab))
153 (list "xml-line-endings" (format nil "A~C~CB~CC&#xD;D" #\Return #\Newline #\Return) (format nil "A~%B~%C~CD" #\Return))
154 (list "sax-chunks" "A<![CDATA[<&]]>&amp;B<!--ignored--><?p ignored?>C" "A<&&BC")))
155 (destructuring-bind (label xml expected) row
156 (name-control label (format nil "<topic id='a'><name><value>~A</value></name></topic>" xml)
157 (lambda (map)
158 (let ((name (first (topic-names (by-id map "a")))))
159 (check (concatenate 'string "name-text:" label)
160 (and (equal expected (topic-name-value name)) (eq (by-id map "a") (topic-name-parent name))
161 (eq (by-si map (default-name-type-identifier)) (topic-name-type name)))))))))
162 (name-control "empty-self-closing" "<topic id='a'><name><value/></name></topic>"
163 (lambda (map) (check "name-text:empty-self-closing" (equal "" (topic-name-value (first (topic-names (by-id map "a")))))))))
164
165 (defun name-identity-controls ()
166 (dolist (order '("<topic id='nt'><subjectIdentifier href='http://psi.topicmaps.org/iso13250/model/topic-name'/></topic><topic id='a'><name><value>N</value></name></topic>"
167 "<topic id='a'><name><value>N</value></name></topic><topic id='nt'><subjectIdentifier href='http://psi.topicmaps.org/iso13250/model/topic-name'/></topic>"))
168 (name-control (if (search "id='nt'" order :end2 20) "default-before" "default-after") order
169 (lambda (map) (check (if (search "id='nt'" order :end2 20) "name-type:before-eq" "name-type:after-eq")
170 (and (= 2 (length (topic-map-topics map)))
171 (eq (by-id map "nt") (topic-name-type (first (topic-names (by-id map "a"))))))))))
172 (name-control "explicit-si-hit" "<topic id='nt'><subjectIdentifier href='urn:type#si'/></topic><topic id='a'><name><type><topicRef href='urn:type#si'/></type><value>N</value></name></topic>"
173 (lambda (map) (check "name-type:si-hit-no-extra-ii"
174 (and (eq (by-id map "nt") (topic-name-type (first (topic-names (by-id map "a")))))
175 (equal (list (concatenate 'string *document* "#nt")) (topic-item-identifiers (by-id map "nt")))))))
176 (name-control "forward-type" "<topic id='a'><name><type><topicRef href='#nt'/></type><value>N</value></name></topic><topic id='nt'/>"
177 (lambda (map) (check "name-type:forward-eq" (eq (by-id map "nt") (topic-name-type (first (topic-names (by-id map "a"))))))))
178 (name-control "different-types" "<topic id='a'><name><type><topicRef href='#one'/></type><value>N</value></name><name><type><topicRef href='#two'/></type><value>N</value></name></topic>"
179 (lambda (map) (let ((names (topic-names (by-id map "a"))))
180 (check "name-equality:type-distinguishes" (and (= 2 (length names)) (not (eq (first names) (second names)))
181 (not (eq (topic-name-type (first names)) (topic-name-type (second names)))))))))
182 (name-control "different-parents" "<topic id='a'><name><value>N</value></name></topic><topic id='b'><name><value>N</value></name></topic>"
183 (lambda (map) (check "name-equality:parent-distinguishes" (not (eq (first (topic-names (by-id map "a"))) (first (topic-names (by-id map "b"))))))))
184 (name-control "same-parent-type-value" "<topic id='a'><name><value>N</value></name><name><value>N</value></name></topic>"
185 (lambda (map) (check "name-equality:duplicate-collapses" (= 1 (length (topic-names (by-id map "a")))))))
186 (name-control "parent-is-default-type" "<topic id='a'><subjectIdentifier href='http://psi.topicmaps.org/iso13250/model/topic-name'/><name><value>N</value></name></topic>"
187 (lambda (map) (check "name-type:parent-and-type-same-eq"
188 (and (= 1 (length (topic-map-topics map))) (eq (by-id map "a") (topic-name-type (first (topic-names (by-id map "a")))))))))
189 (name-control "external-type-no-fetch" "<topic id='a'><name><type><topicRef href='https://unfetched.invalid/map.xtm#t'/></type><value>N</value></name></topic>"
190 (lambda (map) (check "name-type:external-placeholder"
191 (equal '("https://unfetched.invalid/map.xtm#t") (topic-item-identifiers (topic-name-type (first (topic-names (by-id map "a")))))))))
192 ;; This is an existing-model invariant control, not XTM Scope support.
193 (let* ((map (read-body "<topic id='a'><name><value>N</value></name></topic><topic id='s'/>"))
194 (owner (by-id map "a")) (unscoped (first (topic-names owner)))
195 (scoped (add-name owner "N" :scope (list (by-id map "s")))))
196 (normalize-topic-map map)
197 (check "name-equality:existing-tmdm-scope-distinguishes"
198 (and (= 2 (length (topic-names owner))) (not (eq (canonical-topic-name unscoped) (canonical-topic-name scoped)))))
199 (push (topic-maps.test-foundation::fields "label" "existing-tmdm-scope-invariant" "kind" "TMDM-only-control-no-XTM-Scope"
200 "model" (name-model-data map)) *name-controls*)))
201
202 (defun staged-name-control (label body after-step verify)
203 (let* ((topic-maps.xtm::*document-iri* *document*) (topic-maps.xtm::*source-key* label)
204 (map (make-topic-map))
205 (root (topic-maps.xml:parse-octets (bytes (document body)) (make-instance 'topic-maps.xtm::source-handler))))
206 (topic-maps.xtm::validate-source root)
207 (loop for node in (topic-maps.xtm::elements root) for step from 1 do
208 (topic-maps.xtm::read-topic node map) (funcall after-step map step))
209 (funcall verify map)
210 (check (concatenate 'string label ":canonical-references") (names-current-p map))
211 (push (topic-maps.test-foundation::fields "label" label "kind" "staged-native-reader-control"
212 "sourceText" (document body) "model" (name-model-data map)) *name-controls*)))
213
214 (defun retained-name-controls ()
215 (dolist (kind '("itemIdentity" "subjectIdentifier" "subjectLocator"))
216 (let ((a nil) (b nil) (na nil) (nb nil)
217 (label (concatenate 'string "retained-name:" kind)))
218 (staged-name-control label
219 (if (equal kind "itemIdentity")
220 "<topic id='a'><name><value>N</value></name></topic><topic id='b'><name><value>N</value></name></topic><topic id='bridge'><itemIdentity href='#a'/><itemIdentity href='#b'/></topic>"
221 (format nil "<topic id='a'><~A href='urn:a'/><name><value>N</value></name></topic><topic id='b'><~A href='urn:b'/><name><value>N</value></name></topic><topic id='bridge'><~A href='urn:a'/><~A href='urn:b'/></topic>" kind kind kind kind))
222 (lambda (map step)
223 (when (= step 1) (setf a (by-id map "a") na (first (topic-names a))))
224 (when (= step 2) (setf b (by-id map "b") nb (first (topic-names b)))
225 (check (concatenate 'string label ":distinct-before-merge") (and (not (eq a b)) (not (eq na nb))))))
226 (lambda (map)
227 (let* ((owner (by-id map "bridge")) (name (first (topic-names owner)))
228 (before (name-state map)))
229 (check (concatenate 'string label ":retained-parent-and-name-eq")
230 (and (eq owner (canonical-topic a)) (eq owner (canonical-topic b))
231 (eq name (canonical-topic-name na)) (eq name (canonical-topic-name nb))
232 (eq owner (topic-name-parent na)) (eq owner (topic-name-parent nb))
233 (= 1 (length (topic-names owner)))))
234 (topic-maps.cxtm:canonicalize-octets map :base-locator *document*)
235 (check (concatenate 'string label ":cxtm-retains-handles")
236 (and (equal before (name-state map)) (eq name (canonical-topic-name na)) (eq name (canonical-topic-name nb)))))))))
237 (let ((old-type nil) (old-name nil))
238 (staged-name-control "retained-name:default-type-after"
239 "<topic id='a'><name><value>N</value></name></topic><topic id='nt'><subjectIdentifier href='http://psi.topicmaps.org/iso13250/model/topic-name'/></topic><topic id='b'><name><value>B</value></name></topic>"
240 (lambda (map step) (when (= step 1) (setf old-name (first (topic-names (by-id map "a"))) old-type (topic-name-type old-name))))
241 (lambda (map) (check "retained-name:default-type-after-eq"
242 (and (eq (canonical-topic old-type) (by-id map "nt"))
243 (eq (by-id map "nt") (topic-name-type old-name))
244 (eq (topic-name-type old-name) (topic-name-type (first (topic-names (by-id map "b"))))))))))
245 (let ((names nil) (types nil))
246 (staged-name-control "retained-name:type-merge"
247 "<topic id='a'><name><type><topicRef href='#one'/></type><value>N</value></name><name><type><topicRef href='#two'/></type><value>N</value></name></topic><topic id='one'><itemIdentity href='#two'/></topic>"
248 (lambda (map step) (when (= step 1)
249 (setf names (topic-names (by-id map "a")) types (mapcar #'topic-name-type names))
250 (check "retained-name:type-distinct-before" (and (= 2 (length names)) (not (eq (first types) (second types)))))))
251 (lambda (map) (let ((name (first (topic-names (by-id map "a")))))
252 (check "retained-name:type-and-name-canonical-after"
253 (and (= 1 (length (topic-names (by-id map "a"))))
254 (every (lambda (n) (eq name (canonical-topic-name n))) names)
255 (every (lambda (type) (eq (by-id map "one") (canonical-topic type))) types)
256 (eq (by-id map "one") (topic-name-type name)))))))))
257
258 (defun name-syntax-controls ()
259 (dolist (spec '(("missing-value" "<name/>" :missing-name-value)
260 ("missing-value-after-type" "<name><type><topicRef href='#t'/></type></name>" :missing-name-value)
261 ("multiple-values" "<name><value>A</value><value>B</value></name>" :duplicate-name-value)
262 ("multiple-types" "<name><type><topicRef href='#a'/></type><type><topicRef href='#b'/></type><value>N</value></name>" :duplicate-name-type)
263 ("type-no-ref" "<name><type/><value>N</value></name>" :type-cardinality)
264 ("type-multiple-ref" "<name><type><topicRef href='#a'/><topicRef href='#b'/></type><value>N</value></name>" :type-cardinality)
265 ("type-after-value" "<name><value>N</value><type><topicRef href='#t'/></type></name>" :element-order)
266 ("unknown-child" "<name><unknown/><value>N</value></name>" :unexpected-element)
267 ("name-attribute" "<name other='x'><value>N</value></name>" :unexpected-attribute)
268 ("type-attribute" "<name><type other='x'><topicRef href='#t'/></type><value>N</value></name>" :unexpected-attribute)
269 ("value-attribute" "<name><value other='x'>N</value></name>" :unexpected-attribute)
270 ("nested-value" "<name><value><value>N</value></value></name>" :unexpected-child)
271 ("foreign-markup-in-value" "<name><value><b xmlns='urn:other'>N</b></value></name>" :unexpected-child)
272 ("non-topicRef-type-child" "<name><type><subjectIdentifierRef href='urn:t'/></type><value>N</value></name>" :unexpected-element)
273 ("text-in-type" "<name><type>text<topicRef href='#t'/></type><value>N</value></name>" :unexpected-text)
274 ("text-in-name" "<name>text<value>N</value></name>" :unexpected-text)
275 ("reference-without-fragment" "<name><type><topicRef href='urn:t'/></type><value>N</value></name>" :invalid-topic-ref)
276 ("reference-missing-href" "<name><type><topicRef/></type><value>N</value></name>" :missing-attribute)
277 ("reference-attribute" "<name><type><topicRef href='#t' other='x'/></type><value>N</value></name>" :unexpected-attribute)
278 ("wrong-value-namespace" "<name><value xmlns='urn:other'>N</value></name>" :invalid-namespace)
279 ("scope-after-value" "<name><value>N</value><scope><topicRef href='#s'/></scope></name>" :element-order)
280 ("ii-after-value" "<name><value>N</value><itemIdentity href='#name'/></name>" :element-order)
281 ("variant-before-value" "<name><variant><scope><topicRef href='#s'/></scope><resourceData>V</resourceData></variant><value>N</value></name>" :element-order)))
282 (name-error-control (first spec) (format nil "<topic id='a'>~A</topic>" (second spec)) 'xtm-rejection (third spec)))
283 (dolist (spec '(("variant-resourceData-datatype" "<name><value>N</value><variant><scope><topicRef href='#s'/></scope><resourceData datatype='http://www.w3.org/2001/XMLSchema#integer'>42</resourceData></variant></name>" :resource-data-datatype)
284 ("variant-reifier-excluded-datatype" "<name><value>N</value><variant reifier='#r'><scope><topicRef href='#v'/></scope><resourceData datatype='http://www.w3.org/2001/XMLSchema#integer'>42</resourceData></variant></name>" :resource-data-datatype)))
285 (name-error-control (concatenate 'string "unsupported-" (first spec))
286 (format nil "<topic id='a'>~A</topic>" (second spec)) 'xtm-unsupported (third spec)))
287 (let* ((body (format nil "~%<topic id='a'>~% <name/>~%</topic>"))
288 (c (condition-from (lambda () (read-body body)))))
289 (check "name-syntax:multiline-name-position" (and (eq (type-of c) 'xtm-rejection)
290 (eq :missing-name-value (error-code c)) (= 3 (error-line c)) (plusp (error-column c)))))
291 (let* ((raw (bytes "<x:topicMap xmlns:x='http://www.topicmaps.org/xtm/' version='2.0'><x:topic id='a'><x:name><x:value>N</x:value></x:name></x:topic></x:topicMap>"))
292 (map (deserialize-octets raw :document-iri *document*)))
293 (check "name-syntax:qualified-prefix-name" (equal "N" (topic-name-value (first (topic-names (by-id map "a"))))))))
294
295 (defun name-tests ()
296 (setf *name-controls* nil)
297 (name-text-controls) (name-identity-controls) (retained-name-controls) (name-syntax-controls)
298 (setf *name-controls* (nreverse *name-controls*)))