Skip to content

Commit e3b5f28

Browse files
committed
More tests
1 parent af3e5ed commit e3b5f28

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tests/lean/run/string_replace.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
module
2+
13
def isVowel (c : Char) : Bool :=
24
c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'
35

@@ -15,3 +17,5 @@ def isVowel (c : Char) : Bool :=
1517
#guard ("abcde".toSlice.drop 1).replace (· == 'c') "C" = "bCde"
1618
#guard (("ac bc cc cd".toSlice.split " ").map (·.replace 'c' "C") |>.toList) = ["aC", "bC", "CC", "Cd"]
1719
#guard "red green blue".replace (fun c => c == 'u' || c == 'e') "" = "rd grn bl"
20+
#guard "aab".replace "ab" "X" = "aX"
21+
#guard " ℚℚ\n ".replace "\n" "\n" = "\n "

tests/lean/run/string_slice.lean

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ Tests for `String.Slice` functions
2323
#guard ("coffee tea water".toSlice.split ' ').toList == ["coffee".toSlice, "tea".toSlice, "water".toSlice]
2424
#guard ("coffee tea water".toSlice.split " tea ").toList == ["coffee".toSlice, "water".toSlice]
2525
#guard ("baaab".toSlice.split "aa").toList == ["b".toSlice, "ab".toSlice]
26+
#guard ("aababaaba".toSlice.split "ab").toList == ["a".toSlice, "".toSlice, "a".toSlice, "a".toSlice]
2627

2728
#guard ("coffee tea water".toSlice.splitInclusive Char.isWhitespace).toList == ["coffee ".toSlice, "tea ".toSlice, "water".toSlice]
2829
#guard ("coffee tea water".toSlice.splitInclusive ' ').toList == ["coffee ".toSlice, "tea ".toSlice, "water".toSlice]
2930
#guard ("coffee tea water".toSlice.splitInclusive " tea ").toList == ["coffee tea ".toSlice, "water".toSlice]
3031
#guard ("a".toSlice.splitInclusive (fun (_ : Char) => true)).toList == ["a".toSlice]
3132
#guard ("baaab".toSlice.splitInclusive "aa").toList == ["baa".toSlice, "ab".toSlice]
33+
#guard ("aababaaba".toSlice.splitInclusive "ab").toList == ["aab".toSlice, "ab".toSlice, "aab".toSlice, "a".toSlice]
3234

3335
#guard "red green blue".toSlice.drop 4 == "green blue".toSlice
3436
#guard "red green blue".toSlice.drop 10 == "blue".toSlice

0 commit comments

Comments
 (0)