Skip to content

test(phel): mark strict-string divergences in string_test#18

Merged
Chemaclass merged 1 commit into
mainfrom
phel/mark-divergences-sweep
May 29, 2026
Merged

test(phel): mark strict-string divergences in string_test#18
Chemaclass merged 1 commit into
mainfrom
phel/mark-divergences-sweep

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

Summary

Phel's phel.string functions are strict: a non-string argument throws (see phel-lang#2226) rather than being coerced via str / toString the way Clojure JVM (:default) does. The string_test files' :default branches expect coercion (e.g. (str/upper-case :asdf) => ":ASDF"), so they fail under Phel.

Add :phel branches asserting the throw, mirroring the existing :cljs / :lpy / :cljr stance:

  • upper-case, lower-case, capitalize — non-string args throw
  • starts-with?, ends-with? — symbol/keyword args throw (no coercion)
  • blank?\space reads as the single-space string " " in Phel, so blank? returns true (matches :lpy)

reverse, escape already throw on non-strings under all dialects, so they need no change.

Purely additive: other dialects keep their existing branches; Clojure's reader skips the unknown :phel feature.

Verification

test/clojure/string_test/* against phel main: 96 passed, 0 failed, 0 error (was 26 errors / several fails).

Part of the suite-divergence sweep for phel-lang#2223.

Phel's string functions are strict: a non-string argument throws instead of
being coerced via str/toString (the JVM :default behaviour). Add :phel
branches asserting the throw for upper-case / lower-case / capitalize /
starts-with? / ends-with? (mirroring the :cljs/:lpy/:cljr stance). blank?
gets a :phel branch for \space, which Phel reads as the space string " "
(blank? => true) rather than a character type.
@Chemaclass Chemaclass merged commit 80c7a40 into main May 29, 2026
4 checks passed
@Chemaclass Chemaclass deleted the phel/mark-divergences-sweep branch May 29, 2026 13:32
Chemaclass added a commit that referenced this pull request May 29, 2026
Phel's reader resolves :phel (else :default). Add :phel reader-conditional
branches documenting where Phel deliberately diverges from JVM Clojure on
bad-shape / edge input, so the suite is green under Phel without masking
behavior. Builds on #16 (parse-*) and #18 (string_test); covers the
remaining core_test divergences:

- nil-safe / structural returns where Clojure throws (key/val, realized?,
  < <= > >=, min-key/min/max, compare collections, peek/last/ffirst/fnext,
  empty?/not-empty, shuffle/sort-by/case/merge/update/remove/take-nth/map/
  conj/set/select-keys/reverse/keys/vals, nth/nthnext/take/drop/count/
  contains?/partial, keyword/symbol/intern); transients unguarded.
- odd?/even? operate on any number (no integer check) -> kept lenient.
- numeric tower (Bucket B): no auto bigint-promote/overflow in * + - and
  int/long/float/double/byte/rem/quot/mod; numerator/denominator int->n/1.

Suite green under Phel: 5477/5477. Related to phel-lang#2223.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant