plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


1552a6c — Peter John 2026-11-01T21:53:58+05:30
test: Str edge cases from final review
Files changed (1) hide show
  1. plum-std/Str.plum +24 -0
plum-std/Str.plum CHANGED
@@ -852,3 +852,27 @@ test "deburr strips Latin-1 and Latin Extended-A diacritics"
852
852
  assert "œuvre Ÿ ž".deburr() == "oeuvre Y z"
853
853
  assert "plain ASCII 1+1".deburr() == "plain ASCII 1+1"
854
854
  assert "3×4÷2 日本".deburr() == "3×4÷2 日本"
855
+
856
+ test "Str edge cases: empties, sub bounds, replaceAll growth, split ends, utf8 reverse"
857
+ b := Buffer()
858
+ assert b.toStr() == ""
859
+ assert b.toStr() + b.toStr() == ""
860
+ assert {"" + ""}.length() == 0
861
+ assert "hello".sub(5, 5) == ""
862
+ assert "hello".sub(-3, 2) == "he"
863
+ assert "hello".sub(3, 99) == "lo"
864
+ assert "hello".sub(9, 12) == ""
865
+ assert "aa".replaceAll("a", "aa") == "aaaa"
866
+ assert "abc".replaceAll("", "x") == "abc"
867
+ assert "abc".replace("abcd", "z") == "abc"
868
+ parts := ",a,b,".split(",", 0)
869
+ assert parts.length() == 4
870
+ assert parts.get(0)! == ""
871
+ assert parts.get(3)! == ""
872
+ assert "a,b".split("abc,b", 0).length() == 1
873
+ assert "aé".reverse() == "éa"
874
+ assert "日本語".reverse() == "語本日"
875
+ assert "日本語".runeAt(2) == "語"
876
+ assert " é ".trim() == "é"
877
+ assert !"ab".startsWith("abc")
878
+ assert !"ab".endsWith("xab")