content: validation vets list items + table cells element-deep (787/787)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s
validate only checked that list items / table rows-headers ARE lists; a non-string item or non-list/non-string-cell row passed yet crashes asText/ render/find-replace/search. Added ct-all-str?/ct-all-rows? + deepened list/ table branches (guarded against double-reporting). +9 validate tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
(content-bootstrap-blocks!)
|
||||
(content-bootstrap-doc!)
|
||||
(content-bootstrap-section!)
|
||||
(content-bootstrap-table!)
|
||||
|
||||
;; ── a fully valid document ──
|
||||
(define
|
||||
@@ -164,3 +165,62 @@
|
||||
(content/validate dup-tree)))
|
||||
1)
|
||||
(content-test "tree dup not valid" (content/valid? dup-tree) false)
|
||||
|
||||
;; ── collection blocks vetted ELEMENT-DEEP (items/cells must be strings) ──
|
||||
;; A list whose items field is a list but holds a non-string would pass the old
|
||||
;; "is a list" check yet crash asText/render — now caught.
|
||||
(content-test
|
||||
"list non-string item flagged"
|
||||
(content/issue-kinds
|
||||
(doc-append (doc-empty "d") (mk-list "l" true (list "a" 5))))
|
||||
(list "field"))
|
||||
(content-test
|
||||
"list all-string items valid"
|
||||
(content/valid?
|
||||
(doc-append (doc-empty "d") (mk-list "l" false (list "a" "b" "c"))))
|
||||
true)
|
||||
(content-test
|
||||
"list empty items valid"
|
||||
(content/valid? (doc-append (doc-empty "d") (mk-list "l" true (list))))
|
||||
true)
|
||||
;; a malformed-list block reports exactly one element issue (not the is-a-list one)
|
||||
(content-test
|
||||
"list non-string item single issue"
|
||||
(len
|
||||
(content/validate
|
||||
(doc-append
|
||||
(doc-empty "d")
|
||||
(mk-list "l" true (list 1 2)))))
|
||||
1)
|
||||
|
||||
(content-test
|
||||
"valid table ok"
|
||||
(content/valid?
|
||||
(doc-append
|
||||
(doc-empty "d")
|
||||
(mk-table "t" (list "H1" "H2") (list (list "a" "b") (list "c" "d")))))
|
||||
true)
|
||||
(content-test
|
||||
"table empty rows valid"
|
||||
(content/valid?
|
||||
(doc-append (doc-empty "d") (mk-table "t" (list "H") (list))))
|
||||
true)
|
||||
(content-test
|
||||
"table non-list row flagged"
|
||||
(content/issue-kinds
|
||||
(doc-append (doc-empty "d") (mk-table "t" (list "H") (list "notarow"))))
|
||||
(list "field"))
|
||||
(content-test
|
||||
"table non-string cell flagged"
|
||||
(content/issue-kinds
|
||||
(doc-append
|
||||
(doc-empty "d")
|
||||
(mk-table "t" (list "H") (list (list "ok") (list 9)))))
|
||||
(list "field"))
|
||||
(content-test
|
||||
"table non-string header flagged"
|
||||
(content/issue-kinds
|
||||
(doc-append
|
||||
(doc-empty "d")
|
||||
(mk-table "t" (list "H" 2) (list (list "a" "b")))))
|
||||
(list "field"))
|
||||
|
||||
Reference in New Issue
Block a user