diff --git a/examples/tests/sdk_tests/std/string.w b/examples/tests/sdk_tests/std/string.w index 7f33a09e3b7..fc13b2a90dd 100644 --- a/examples/tests/sdk_tests/std/string.w +++ b/examples/tests/sdk_tests/std/string.w @@ -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"); +}