<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.limswiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AString%2Ftestcases</id>
	<title>Module:String/testcases - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.limswiki.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AString%2Ftestcases"/>
	<link rel="alternate" type="text/html" href="https://www.limswiki.org/index.php?title=Module:String/testcases&amp;action=history"/>
	<updated>2026-04-05T16:25:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://www.limswiki.org/index.php?title=Module:String/testcases&amp;diff=13209&amp;oldid=prev</id>
		<title>Shawndouglas: Created as needed.</title>
		<link rel="alternate" type="text/html" href="https://www.limswiki.org/index.php?title=Module:String/testcases&amp;diff=13209&amp;oldid=prev"/>
		<updated>2013-10-31T15:49:53Z</updated>

		<summary type="html">&lt;p&gt;Created as needed.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Unit tests for [[Module:String]]. Click talk page to run tests.&lt;br /&gt;
local p = require('Module:UnitTests')&lt;br /&gt;
 &lt;br /&gt;
function p:test_len()&lt;br /&gt;
    self:preprocess_equals_many('{{#invoke:String/sandbox|len|', '}}', {&lt;br /&gt;
        {' foo ', '5'},&lt;br /&gt;
        {'s= foo ', '3'},&lt;br /&gt;
        {'', '0'},&lt;br /&gt;
        {'s=', '0'},&lt;br /&gt;
        {'   ', '3'},&lt;br /&gt;
        {'最近の更新', '5'},&lt;br /&gt;
    })&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p:test_replace()&lt;br /&gt;
    self:preprocess_equals_many('{{#invoke:String/sandbox|replace|', '}}', {&lt;br /&gt;
        {'1.1.1.1|.|/', '1/1/1/1'},&lt;br /&gt;
        {'alpha (beta)| (| gamma (', 'alpha gamma (beta)'},&lt;br /&gt;
        {'Dog (cat)|%s%(.*%)||plain=false', 'Dog'},&lt;br /&gt;
    })&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p:test_match()&lt;br /&gt;
    self:preprocess_equals_many('{{#invoke:String/sandbox|match|', '}}', {&lt;br /&gt;
        {'dog (cat)|%((%a-)%)', 'cat'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)||-1', 'fish'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)||2', 'canary'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)|6|1', 'canary'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)|6|2', 'fish'},&lt;br /&gt;
        {'dog (cat)|%((%a-)%)||2|no_category=true', '&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;String Module Error: Match not found&amp;lt;/strong&amp;gt;'},&lt;br /&gt;
        {'dog (cat)|%((%a-)%)||2|ignore_errors=true', ''},&lt;br /&gt;
    })&lt;br /&gt;
end&lt;br /&gt;
function p:test_match()&lt;br /&gt;
    self:preprocess_equals_many('{{#invoke:String/sandbox|match|', '}}', {&lt;br /&gt;
        {'dog (cat)|%((%a-)%)', 'cat'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)||-1', 'fish'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)||2', 'canary'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)|6|1', 'canary'},&lt;br /&gt;
        {'dog (cat) (canary) (fish)|%((%a-)%)|6|2', 'fish'},&lt;br /&gt;
        {'dog (cat)|%((%a-)%)||2|no_category=true', '&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;String Module Error: Match not found&amp;lt;/strong&amp;gt;'},&lt;br /&gt;
        {'dog (cat)|%((%a-)%)||2|ignore_errors=true', ''},&lt;br /&gt;
    })&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p:test_find()&lt;br /&gt;
    self:preprocess_equals_many('{{#invoke:String/sandbox|find|', '}}', {&lt;br /&gt;
        {'', '0'},&lt;br /&gt;
        {'source=', '0'},&lt;br /&gt;
        {'source=|target=', '0'},&lt;br /&gt;
        {'source=|target=Bob', '0'},&lt;br /&gt;
        {'Bob|Joe', '0'},&lt;br /&gt;
        {'Bob|b', '3'},&lt;br /&gt;
        {'Bob Joe|oe', '6'},&lt;br /&gt;
        {'source= Bob |o', '2'},&lt;br /&gt;
        {' Bob |o', '3'},&lt;br /&gt;
        {'높지만 급격히|만', '3'},&lt;br /&gt;
        {'source=BAAAB|target=%w|plain=false', '1'},&lt;br /&gt;
        {'source=BAAAB|target=%w|start=3|plain=false', '3'},&lt;br /&gt;
        {'source=BAAAB|target=(%w)%1|plain=false', '2'},&lt;br /&gt;
    })&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p:test_rep()&lt;br /&gt;
    self:preprocess_equals_many('{{#invoke:String/sandbox|rep|', '}}', {&lt;br /&gt;
        {'abc|1', 'abc'},&lt;br /&gt;
        {'a b|7', 'a ba ba ba ba ba ba b'},&lt;br /&gt;
        {'bla|glug|no_category=true', '&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;String Module Error: function rep expects a number as second parameter, received &amp;quot;glug&amp;quot;&amp;lt;/strong&amp;gt;'},&lt;br /&gt;
        {'bla|glug|ignore_errors=true', ''},&lt;br /&gt;
        {'àèò|3', 'àèòàèòàèò'}&lt;br /&gt;
    })&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Shawndouglas</name></author>
	</entry>
</feed>