Implement STRRPL

Fixes #660

STRRPL(str, "", new) does nothing
(warn about it with -Wempty-strrpl)
This commit is contained in:
Rangi
2020-12-30 11:00:44 -05:00
committed by Eldred Habert
parent 669a392fcd
commit 77279984a5
10 changed files with 88 additions and 13 deletions

6
test/asm/strrpl.asm Normal file
View File

@@ -0,0 +1,6 @@
println strrpl("\tld [hli], a", "[hli]", "[hl+]")
println strrpl("lolololol", "lol", "hah")
println strrpl("h e ll o", " ", "")
println strrpl("world", "", "x")
println strrpl("", "a", "b")
println strrpl("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "a", "[bbbbbbbb]")

4
test/asm/strrpl.err Normal file
View File

@@ -0,0 +1,4 @@
warning: strrpl.asm(4): [-Wempty-strrpl]
STRRPL: Cannot replace an empty string
warning: strrpl.asm(6): [-Wlong-string]
STRRPL: String too long, got truncated

6
test/asm/strrpl.out Normal file
View File

@@ -0,0 +1,6 @@
ld [hl+], a
hahohahol
hello
world
[bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbbbbbb][bbbb