Skip to content

Commit

Permalink
Re-add missing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
bensku committed Jan 10, 2020
1 parent 1ec2547 commit 1726477
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/test/skript/tests/syntaxes/effects/EffReplace.sk
Original file line number Diff line number Diff line change
Expand Up @@ -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"


0 comments on commit 1726477

Please sign in to comment.