From 1726477656bce56ace06acf351b4e34279bae14b Mon Sep 17 00:00:00 2001 From: bensku Date: Fri, 10 Jan 2020 17:36:16 +0200 Subject: [PATCH] Re-add missing test case --- .../tests/syntaxes/effects/EffReplace.sk | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/skript/tests/syntaxes/effects/EffReplace.sk b/src/test/skript/tests/syntaxes/effects/EffReplace.sk index 25188fc4dff..09537a3ddec 100644 --- a/src/test/skript/tests/syntaxes/effects/EffReplace.sk +++ b/src/test/skript/tests/syntaxes/effects/EffReplace.sk @@ -14,3 +14,32 @@ test "replace items": set {_inv2} to {_inv} replace all emerald in {_inv} with diamond assert {_inv} is {_inv2} with "replace non-existent item changed inventory" + +test "replace strings": + loop 8 times: + set {_text::%loop-number%} to "My name is bob and this is my friend bob!" + + # Original Replace + replace all "bob" in {_text::1} with "bobby" + replace all "bob" with "bobby" in {_text::2} + + # Replace First + replace first "bob" in {_text::3} with "bobby" + replace first "bob" with "bobby" in {_text::4} + + # Case Sensitivity + replace all "bob" in {_text::5} with "BOBBY" with case sensitivity + replace all "BOB" with "bobby" in {_text::6} with case sensitivity + replace first "bob" in {_text::7} with "BOBBY" with case sensitivity + replace first "BOB" with "bobby" in {_text::8} with case sensitivity + + assert {_text::1} is "My name is bobby and this is my friend bobby!" with "replace all pattern 1 (case sensitivity disabled) (%{_text::1}%) failed" + assert {_text::2} is "My name is bobby and this is my friend bobby!" with "replace all pattern 2 (case sensitivity disabled) (%{_text::2}%) failed" + assert {_text::3} is "My name is bobby and this is my friend bob!" with "replace first pattern 1 (case sensitivity disabled) (%{_text::3}%) failed" + assert {_text::4} is "My name is bobby and this is my friend bob!" with "replace first pattern 2 (case sensitivity disabled) (%{_text::4}%) failed" + assert {_text::5} is "My name is BOBBY and this is my friend BOBBY!" with "replace all pattern 2 (case sensitivity enabled) (%{_text::6}%) failed" + assert {_text::6} is "My name is bob and this is my friend bob!" with "replace all pattern 1 (case sensitivity enabled) (%{_text::5}%) failed" + assert {_text::7} is "My name is BOBBY and this is my friend bob!" with "replace first pattern 2 (case sensitivity enabled) (%{_text::8}%) failed" + assert {_text::8} is "My name is bob and this is my friend bob!" with "replace first pattern 1 (case sensitivity enabled) (%{_text::7}%) failed" + + \ No newline at end of file