Module:String2/testcases

-- Unit tests for Module:. Click talk page to run tests. local p = require('Module:UnitTests')

function p:test_sentence self:preprocess_equals_sandbox_many('{{#invoke:String2', 'sentence', {       {'*teSt', '\n*Test'},        {'tEst', 'Test'},        {'pipeTest', 'Pipetest'},        {'32ND', '32nd'},        {'3 &times;', '3 &times;'},        {'TEST', 'Test'},        {'1900 – 2000', '1900 – 2000'},        {'éclair', 'Éclair'},        {'Äpfel', 'Äpfel'},        -- this requires options.stripmarker to be implemented for preprocess_equals_sandbox_many        {'teXT TeXT ', 'Text TeXT '},	}) end

function p:test_ucfirst self:preprocess_equals_sandbox_many('{{#invoke:String2', 'ucfirst', {       {'*test', '\n*Test'},        {'test', 'Test'},        {'pipetest', 'Pipetest'},        {'32nd', '32nd'},        {'3 &times;', '3 &times;'},        {'test', 'Test'},        {'1900 – 2000', '1900 – 2000'},        {'éclair', 'Éclair'},        {'äpfel', 'Äpfel'},        {'endocrinology, infectious disease', 'Endocrinology, infectious disease'},        {'[//example.com ext link test]', '[//example.com ext link test]'},    }) end

function p:test_matchAny self:preprocess_equals_sandbox_many('{{#invoke:String2','matchAny', {   	{'123|abc|source=adc 123', '1'},    	{'123|abc|source=adc 124', ''},    	{'123|abc|source=abc 124', '2'},     },{nowiki=1}) end

--sentence|ThE RaIN In Spain falls mainly on THE PLANE.}}',		'The rain in spain falls mainly on the plane.',		{ stripmarker = true })	self:preprocess_equals_preprocess('{{#invoke:String2|sentence|ThE RaIN In Spain mainly on THE PLANE.}}',		'The rain in spain mainly on the plane.', { stripmarker = true }) end --

return p