Module talk:Ustring/testcases
Appearance
2 of 10 tests failed.
test_gsub
Test | Live | Sandbox | Expected | |
---|---|---|---|---|
![]() |
{{#invoke:ustring|gsub| hello world | world | x }} | hello x | hello x | hello x |
![]() |
{{#invoke:ustring|gsub| hello world| world | x }} | hello world | hello world | hello world |
test_onerror
Test | Live | Sandbox | Expected | |
---|---|---|---|---|
![]() |
{{#invoke:ustring|sub| hello | 1 | 3 | onerror = foo}} | he | he | he |
![]() |
{{#invoke:ustring|sub| s1 = hello | bar | 3 | onerror = foo}} | Lua error: bad argument #2 to 'sub' (number expected, got string). | foo | foo |
![]() |
{{#invoke:ustring|sub| s1 = hello | 0 | | onerror = foo}} | Lua error: bad argument #3 to 'sub' (number expected, got string). | foo | foo |
test_sub
Test | Live | Sandbox | Expected | |
---|---|---|---|---|
![]() |
{{#invoke:ustring|sub| hello | 1 | 3}} | he | he | he |
![]() |
{{#invoke:ustring|sub| s1 = hello | 1 | 3}} | hel | hel | hel |
![]() |
{{#invoke:ustring|sub| s1 = hello | 0 | 3}} | hel | hel | hel |
![]() |
{{#invoke:ustring|sub| s1 = hello | -3 }} | llo | llo | llo |
![]() |
{{#invoke:ustring|sub| hello | -3 }} | lo | lo | lo |