Skip to content

Commit

Permalink
adding string.replace() tests
Browse files Browse the repository at this point in the history
  • Loading branch information
garysassano committed Jul 29, 2023
1 parent 965ed77 commit cae7c29
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/tests/sdk_tests/std/string.w
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,20 @@ test "contains()" {
assert(!"hello wing".contains("Hello"));
assert("hello wing".contains("w"));
}

//-----------------------------------------------------------------------------
// replace()

assert("hello world".replace("world", "wing") == "hello wing");
assert("pʅɹoʍ oʅʅǝɥ".replace("pʅɹoʍ", "ɓuᴉʍ") == "ɓuᴉʍ oʅʅǝɥ");
assert("hello world".replace("wing", "☁") == "hello world");
assert("hello world".replace(" ", "-") == "hello-world");
assert("".replace("", "hello world") == "hello world");

test "replace()" {
assert("hello world".replace("world", "wing") == "hello wing");
assert("pʅɹoʍ oʅʅǝɥ".replace("pʅɹoʍ", "ɓuᴉʍ") == "ɓuᴉʍ oʅʅǝɥ");
assert("hello world".replace("wing", "☁") == "hello world");
assert("hello world".replace(" ", "-") == "hello-world");
assert("".replace("", "hello world") == "hello world");
}

0 comments on commit cae7c29

Please sign in to comment.