mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-12 23:50:20 +03:00
Add expect tests for Str.splitLast
This commit is contained in:
parent
d89253779a
commit
97f49bf940
@ -351,6 +351,9 @@ expect Str.splitLast "foo" "o" == Ok { before: "fo", after: "" }
|
||||
# splitLast with multi-byte needle
|
||||
expect Str.splitLast "hullabaloo" "ab" == Ok { before: "hull", after: "aloo" }
|
||||
|
||||
# splitLast when needle is haystack
|
||||
expect Str.splitLast "foo" "foo" == Ok { before: "", after: "" }
|
||||
|
||||
lastMatch : Str, Str -> [Some Nat, None]
|
||||
lastMatch = \haystack, needle ->
|
||||
haystackLength = Str.countUtf8Bytes haystack
|
||||
|
Loading…
Reference in New Issue
Block a user