test(phel): mark strict-string divergences in string_test#18
Merged
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phel's
phel.stringfunctions are strict: a non-string argument throws (see phel-lang#2226) rather than being coerced viastr/toStringthe way Clojure JVM (:default) does. Thestring_testfiles':defaultbranches expect coercion (e.g.(str/upper-case :asdf)=>":ASDF"), so they fail under Phel.Add
:phelbranches asserting the throw, mirroring the existing:cljs/:lpy/:cljrstance:upper-case,lower-case,capitalize— non-string args throwstarts-with?,ends-with?— symbol/keyword args throw (no coercion)blank?—\spacereads as the single-space string" "in Phel, soblank?returnstrue(matches:lpy)reverse,escapealready 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
:phelfeature.Verification
test/clojure/string_test/*against phelmain: 96 passed, 0 failed, 0 error (was 26 errors / several fails).Part of the suite-divergence sweep for phel-lang#2223.