模組討論:String/testcases

全部通過。

test_find
文本 預期 實際結果
checkY {{#invoke:String/sandbox|find|}} 0 0
checkY {{#invoke:String/sandbox|find|source=}} 0 0
checkY {{#invoke:String/sandbox|find|source=|target=}} 0 0
checkY {{#invoke:String/sandbox|find|source=|target=Bob}} 0 0
checkY {{#invoke:String/sandbox|find|Bob|Joe}} 0 0
checkY {{#invoke:String/sandbox|find|Bob|b}} 3 3
checkY {{#invoke:String/sandbox|find|Bob Joe|oe}} 6 6
checkY {{#invoke:String/sandbox|find|source= Bob |o}} 2 2
checkY {{#invoke:String/sandbox|find| Bob |o}} 3 3
checkY {{#invoke:String/sandbox|find|높지만 급격히|만}} 3 3
checkY {{#invoke:String/sandbox|find|source=BAAAB|target=%w|plain=false}} 1 1
checkY {{#invoke:String/sandbox|find|source=BAAAB|target=%w|start=3|plain=false}} 3 3
checkY {{#invoke:String/sandbox|find|source=BAAAB|target=(%w)%1|plain=false}} 2 2
test_len
文本 預期 實際結果
checkY {{#invoke:String/sandbox|len| foo }} 5 5
checkY {{#invoke:String/sandbox|len|s= foo }} 3 3
checkY {{#invoke:String/sandbox|len|}} 0 0
checkY {{#invoke:String/sandbox|len|s=}} 0 0
checkY {{#invoke:String/sandbox|len| }} 3 3
checkY {{#invoke:String/sandbox|len|最近の更新}} 5 5
test_match
文本 預期 實際結果
checkY {{#invoke:String/sandbox|match|dog (cat)|%((%a-)%)}} cat cat
checkY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)||-1}} fish fish
checkY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)||2}} canary canary
checkY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)|6|1}} canary canary
checkY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)|6|2}} fish fish
checkY {{#invoke:String/sandbox|match|dog (cat)|%((%a-)%)||2|no_category=true}} 字符串模塊出錯:找不到匹配 字符串模塊出錯:找不到匹配
checkY {{#invoke:String/sandbox|match|dog (cat)|%((%a-)%)||2|ignore_errors=true}}
test_rep
文本 預期 實際結果
checkY {{#invoke:String/sandbox|rep|abc|1}} abc abc
checkY {{#invoke:String/sandbox|rep|a b|7}} a ba ba ba ba ba ba b a ba ba ba ba ba ba b
checkY {{#invoke:String/sandbox|rep|bla|glug|no_category=true}} 字符串模塊出錯:function rep expects a number as second parameter, received "glug" 字符串模塊出錯:function rep expects a number as second parameter, received "glug"
checkY {{#invoke:String/sandbox|rep|bla|glug|ignore_errors=true}}
checkY {{#invoke:String/sandbox|rep|àèò|3}} àèòàèòàèò àèòàèòàèò
test_replace
文本 預期 實際結果
checkY {{#invoke:String/sandbox|replace|1.1.1.1|.|/}} 1/1/1/1 1/1/1/1
checkY {{#invoke:String/sandbox|replace|alpha (beta)| (| gamma (}} alpha gamma (beta) alpha gamma (beta)
checkY {{#invoke:String/sandbox|replace|Dog (cat)|%s%(.*%)||plain=false}} Dog Dog
test_split
文本 預期 實際結果
checkY {{#invoke:String/sandbox|split|---123-45-6-----|-|yes|no|{{{1}}},}} ,,,123,45,6,,,,,, ,,,123,45,6,,,,,,
checkY {{#invoke:String/sandbox|split|---123-45-6-----|-|yes|yes|{{{1}}},}} 123,45,6, 123,45,6,
checkY {{#invoke:String/sandbox|split|12-34--56-78|-|yes|no|{{{1}}},}} 12,34,,56,78, 12,34,,56,78,
checkY {{#invoke:String/sandbox|split|12-34--56-78|-|yes|yes|{{{1}}},}} 12,34,56,78, 12,34,56,78,
checkY {{#invoke:String/sandbox|split|AB12C3D4E|%d|no|no|{{{1}}},}} AB,,C,D,E, AB,,C,D,E,
checkY {{#invoke:String/sandbox|split|AB12C3D4E|%d|no|yes|{{{1}}},}} AB,C,D,E, AB,C,D,E,
checkY {{#invoke:String/sandbox|split|AB12C3D4E|%d+|no|no|{{{1}}},}} AB,C,D,E, AB,C,D,E,

發起關於Module:String/testcases的討論

發起討論
返回 "String/testcases" 頁面。