test: comprehensive spec — regex + sorted colls + random/predicate gaps

Filling the biggest untested clojure.core areas found in a coverage audit
(168 of 506 provided fns had no spec). New + expanded suites:

- regex-spec.janet (20): #"…" literals, regex?, re-find/re-matches/re-seq
  (match/no-match/groups), re-pattern, and clojure.string split/replace with
  regex (incl $1 backrefs). Whole area was previously unspecced.
- sorted-spec.janet (14): sorted-map/sorted-set construction + ordering, sorted?,
  subseq/rsubseq. Pins the working subset — get/conj/assoc/keys/vals on sorted
  colls and the by-comparator ctors are not yet first-class (jolt-ti9).
- predicates-spec +14: seqable?, integer?, reduced?/unreduced, not-empty.
- numbers-spec +5: rand/rand-int/rand-nth invariants.

Fix: sorted? was bound to core-sorted-map? so it returned false for sorted-sets;
now true for both sorted maps and sets (core-sorted?).

Filed: jolt-ti9 (sorted collections incomplete: get/conj/assoc/keys/vals don't
operate on the sorted wrapper; sorted-*-by ignore the comparator).

Gate green incl full jpm build + jpm test.
This commit is contained in:
Yogthos 2026-06-09 23:35:51 -04:00
parent 977c768575
commit ae8b635602
5 changed files with 88 additions and 1 deletions

View file

@ -113,3 +113,19 @@
["not= differs" "true" "(not= [1 2] [1 3])"]
["identical? same kw" "true" "(identical? :a :a)"]
["compare strings" "-1" "(compare \"a\" \"b\")"])
(defspec "predicates / seqable, reduced & emptiness"
["seqable? vector" "true" "(seqable? [1])"]
["seqable? map" "true" "(seqable? {:a 1})"]
["seqable? string" "true" "(seqable? \"s\")"]
["seqable? nil" "true" "(seqable? nil)"]
["seqable? number" "false" "(seqable? 5)"]
["integer? int" "true" "(integer? 5)"]
["integer? fraction" "false" "(integer? 5.5)"]
["reduced? wrapped" "true" "(reduced? (reduced 1))"]
["reduced? plain" "false" "(reduced? 1)"]
["unreduced wrapped" "9" "(unreduced (reduced 9))"]
["unreduced plain" "9" "(unreduced 9)"]
["not-empty full" "[1]" "(not-empty [1])"]
["not-empty empty" "nil" "(not-empty [])"]
["not-empty string" "nil" "(not-empty \"\")"])