Module talk:String2/testcases
Add topicAppearance
All 41 live tests passed. 6 of 41 sandbox tests failed. (refresh)
test_sentence
| Test | Live | Sandbox | Expected | |
|---|---|---|---|---|
| {{#invoke:String2|sentence|*teSt}} |
|
|
| |
| {{#invoke:String2|sentence|[[tEst]]}} | Test | Test | Test | |
| {{#invoke:String2|sentence|[[test|pipeTest]]}} | Pipetest | Pipetest | Pipetest | |
| {{#invoke:String2|sentence|32ND}} | 32nd | 32nd | 32nd | |
| {{#invoke:String2|sentence|3 ×}} | 3 × | 3 × | 3 × | |
| {{#invoke:String2|sentence|<li>TEST</li>}} | ||||
| {{#invoke:String2|sentence|1900 – 2000}} | 1900 – 2000 | 1900 – 2000 | 1900 – 2000 | |
| {{#invoke:String2|sentence|éclair}} | Éclair | Éclair | Éclair | |
| {{#invoke:String2|sentence|Äpfel}} | Äpfel | Äpfel | Äpfel | |
| {{#invoke:String2|sentence|teXT <nowiki>TeXT</nowiki>}} | Text TeXT | Text TeXT | Text TeXT |
test_ucfirst
| Test | Live | Sandbox | Expected | |
|---|---|---|---|---|
| {{#invoke:String2|ucfirst|*test}} | *Test | *Test | *Test | |
| {{#invoke:String2|ucfirst|[[test]]}} | [[Test]] | [[Test]] | [[Test]] | |
| {{#invoke:String2|ucfirst|[[test|pipetest]]}} | [[test|Pipetest]] | [[test|Pipetest]] | [[test|Pipetest]] | |
| {{#invoke:String2|ucfirst|32nd}} | 32nd | 32nd | 32nd | |
| {{#invoke:String2|ucfirst|3 ×}} | 3 × | 3 × | 3 × | |
| {{#invoke:String2|ucfirst|<li>test</li>}} | <li>Test</li> | <li>Test</li> | <li>Test</li> | |
| {{#invoke:String2|ucfirst|1900 – 2000}} | 1900 – 2000 | 1900 – 2000 | 1900 – 2000 | |
| {{#invoke:String2|ucfirst|éclair}} | Éclair | Éclair | Éclair | |
| {{#invoke:String2|ucfirst|äpfel}} | Äpfel | Äpfel | Äpfel | |
| {{#invoke:String2|ucfirst|[[endocrinology]], [[infectious disease (medical specialty)|infectious disease]]}} | [[Endocrinology]], [[infectious disease (medical specialty)|infectious disease]] | [[Endocrinology]], [[infectious disease (medical specialty)|infectious disease]] | [[Endocrinology]], [[infectious disease (medical specialty)|infectious disease]] | |
| {{#invoke:String2|ucfirst|[//example.com ext link test]}} | [//example.com Ext link test] | [//example.com Ext link test] | [//example.com Ext link test] |
test_matchAny
| Test | Live | Sandbox | Expected | |
|---|---|---|---|---|
| {{#invoke:String2|matchAny|123|abc|source=adc 123}} | 1 | 1 | 1 | |
| {{#invoke:String2|matchAny|123|abc|source=adc 124}} | ||||
| {{#invoke:String2|matchAny|123|abc|source=abc 124}} | 2 | 2 | 2 |
test_getError
| Test | Live | Sandbox | Expected | |
|---|---|---|---|---|
| {{#invoke:String2|getError|123}} | ||||
| {{#invoke:String2|getError|error}} | ||||
| {{#invoke:String2|getError|Expression error}} | ||||
| {{#invoke:String2|getError|1=text<strong class="error">Expression error: Unrecognized word "california".</strong>text}} | <strong class="error">Expression error: Unrecognized word "california".</strong> | <strong class="error">Expression error: Unrecognized word "california".</strong> | <strong class="error">Expression error: Unrecognized word "california".</strong> |
test_isInteger
| Test | Live | Sandbox | Expected | |
|---|---|---|---|---|
| {{#invoke:String2|isInteger|1993}} | true | <strong class="error"><span class="scribunto-error mw-scribunto-error-0ae67507">Script error: The function "isInteger" does not exist.</span></strong> | true | |
| {{#invoke:String2|isInteger|1993|02|24|08|30}} | true | <strong class="error"><span class="scribunto-error mw-scribunto-error-0ae67507">Script error: The function "isInteger" does not exist.</span></strong> | true | |
| {{#invoke:String2|isInteger|1993|02||08|30|empty=yes}} | true | <strong class="error"><span class="scribunto-error mw-scribunto-error-0ae67507">Script error: The function "isInteger" does not exist.</span></strong> | true | |
| {{#invoke:String2|isInteger|1993|02| |08|30|empty=yes}} | true | <strong class="error"><span class="scribunto-error mw-scribunto-error-0ae67507">Script error: The function "isInteger" does not exist.</span></strong> | true | |
| {{#invoke:String2|isInteger|}} | false | <strong class="error"><span class="scribunto-error mw-scribunto-error-0ae67507">Script error: The function "isInteger" does not exist.</span></strong> | false | |
| {{#invoke:String2|isInteger|1993|02||08|30}} | false | <strong class="error"><span class="scribunto-error mw-scribunto-error-0ae67507">Script error: The function "isInteger" does not exist.</span></strong> | false |
test_strip
| Test | Live | Sandbox | Expected | |
|---|---|---|---|---|
| {{#invoke:String2|strip|abc123def|123}} | abcdef | abcdef | abcdef | |
| {{#invoke:String2|strip|abc123def|xyz}} | abc123def | abc123def | abc123def | |
| {{#invoke:String2|strip|abc123def|%d+|false}} | abcdef | abcdef | abcdef | |
| {{#invoke:String2|strip|abc123def|%d+|true}} | abc123ef | abc123ef | abc123ef | |
| {{#invoke:String2|strip|source=abc123def|chars=123}} | abcdef | abcdef | abcdef | |
| {{#invoke:String2|strip|source=abc123def|chars=%d+|plain=false}} | abcdef | abcdef | abcdef | |
| {{#invoke:String2|strip|source=abc123def|chars=%d+|plain=true}} | abc123ef | abc123ef | abc123ef |