feat(strictness): subs validates bounds; assoc! bounds-checks vector index
- subs requires a string and validates 0<=start<=end<=count (no Janet from-end/clamping); negative/out-of-range/nil indices throw - assoc! on a transient vector bounds-checks the index (0..count) subs 11-fail -> 24/5 (5 remaining are byte-vs-codepoint Unicode, platform); assoc_bang 32/6 -> 35/3. clojure-test-suite pass 3889->3898. spec: string/subs-strictness (7), transient/assoc!-bounds (4). jpm test green.
This commit is contained in:
parent
6544d8ef44
commit
740b50aef3
4 changed files with 35 additions and 6 deletions
|
|
@ -90,3 +90,9 @@
|
|||
["conj! no args" "[]" "(persistent! (conj!))"]
|
||||
["conj! identity" "[1 2]" "(conj! [1 2])"]
|
||||
["conj! map merges map" "{:a 1, :b 2}" "(persistent! (conj! (transient {:a 1}) {:b 2}))"])
|
||||
|
||||
(defspec "transient / assoc! bounds"
|
||||
["assoc! existing idx" "[1 9 3]" "(persistent! (assoc! (transient [1 2 3]) 1 9))"]
|
||||
["assoc! at count grows" "[1 2 3]" "(persistent! (assoc! (transient [1 2]) 2 3))"]
|
||||
["assoc! out of bounds" :throws "(assoc! (transient [0 1 2]) 4 4)"]
|
||||
["assoc! negative" :throws "(assoc! (transient []) -1 0)"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue