Add expect tests for Str.splitLast

This commit is contained in:
kilianv 2022-09-01 16:59:11 +02:00
parent d89253779a
commit 97f49bf940
No known key found for this signature in database
GPG Key ID: 8E1AEB931E0A6174

View File

@ -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