• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / core / 5190

17 Jul 2026 01:26AM UTC coverage: 91.284% (+0.02%) from 91.268%
5190

push

github

bobzhang
feat(string): add split_at for lossless surrogate-safe partition

Companion to clamped_view: splits at a code-unit offset clamped to the
string and snapped DOWN to the nearest character boundary, returning
(prefix, suffix) views. The defining invariant is losslessness:
prefix + suffix == self at every offset — something two clamped_view
calls cannot provide, since end snaps down while start snaps up and a
character straddling the cut would vanish from both halves. The prefix
never exceeds the requested unit count; a straddling character goes to
the suffix. Total, O(1); unpaired surrogates are boundaries.

Provided for String and StringView (view-relative). Tests include a
sweep asserting the lossless invariant at every offset from -2 to
len+2, snap-down cases, unpaired-surrogate pass-through, and
view-window containment.
Reviewed by Codex CLI (codex-cli 0.144.1): "Approved — no findings.
The pairing predicate exactly matches clamped_view... the halves
exactly tile the original view. A tuple is appropriate for this total
operation; Option/abort belong to exact-boundary APIs."

Signed-off-by: Codex CLI <codex@openai.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

15752 of 17256 relevant lines covered (91.28%)

190577.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

99.13
/builtin/stringview.mbt


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc