Module talk:String/testcases

From Wikipedia, the free encyclopedia
Jump to: navigation, search

All tests passed.

test_find:

Text Expected Actual
YesY {{#invoke:String/sandbox|find|}} 0 0
YesY {{#invoke:String/sandbox|find|source=}} 0 0
YesY {{#invoke:String/sandbox|find|source=|target=}} 0 0
YesY {{#invoke:String/sandbox|find|source=|target=Bob}} 0 0
YesY {{#invoke:String/sandbox|find|Bob|Joe}} 0 0
YesY {{#invoke:String/sandbox|find|Bob|b}} 3 3
YesY {{#invoke:String/sandbox|find|Bob Joe|oe}} 6 6
YesY {{#invoke:String/sandbox|find|source= Bob |o}} 2 2
YesY {{#invoke:String/sandbox|find| Bob |o}} 3 3
YesY {{#invoke:String/sandbox|find|높지만 급격히|만}} 3 3
YesY {{#invoke:String/sandbox|find|source=BAAAB|target=%w|plain=false}} 1 1
YesY {{#invoke:String/sandbox|find|source=BAAAB|target=%w|start=3|plain=false}} 3 3
YesY {{#invoke:String/sandbox|find|source=BAAAB|target=(%w)%1|plain=false}} 2 2

test_len:

Text Expected Actual
YesY {{#invoke:String/sandbox|len| foo }} 5 5
YesY {{#invoke:String/sandbox|len|s= foo }} 3 3
YesY {{#invoke:String/sandbox|len|}} 0 0
YesY {{#invoke:String/sandbox|len|s=}} 0 0
YesY {{#invoke:String/sandbox|len| }} 3 3
YesY {{#invoke:String/sandbox|len|最近の更新}} 5 5

test_match:

Text Expected Actual
YesY {{#invoke:String/sandbox|match|dog (cat)|%((%a-)%)}} cat cat
YesY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)||-1}} fish fish
YesY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)||2}} canary canary
YesY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)|6|1}} canary canary
YesY {{#invoke:String/sandbox|match|dog (cat) (canary) (fish)|%((%a-)%)|6|2}} fish fish
YesY {{#invoke:String/sandbox|match|dog (cat)|%((%a-)%)||2|no_category=true}} String Module Error: Match not found String Module Error: Match not found
YesY {{#invoke:String/sandbox|match|dog (cat)|%((%a-)%)||2|ignore_errors=true}}

test_rep:

Text Expected Actual
YesY {{#invoke:String/sandbox|rep|abc|1}} abc abc
YesY {{#invoke:String/sandbox|rep|a b|7}} a ba ba ba ba ba ba b a ba ba ba ba ba ba b
YesY {{#invoke:String/sandbox|rep|bla|glug|no_category=true}} String Module Error: function rep expects a number as second parameter, received "glug" String Module Error: function rep expects a number as second parameter, received "glug"
YesY {{#invoke:String/sandbox|rep|bla|glug|ignore_errors=true}}
YesY {{#invoke:String/sandbox|rep|àèò|3}} àèòàèòàèò àèòàèòàèò

test_replace:

Text Expected Actual
YesY {{#invoke:String/sandbox|replace|1.1.1.1|.|/}} 1/1/1/1 1/1/1/1
YesY {{#invoke:String/sandbox|replace|alpha (beta)| (| gamma (}} alpha gamma (beta) alpha gamma (beta)
YesY {{#invoke:String/sandbox|replace|Dog (cat)|%s%(.*%)||plain=false}} Dog Dog