Jump to content

Module:Infobox sort/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 2: Line 2:
local p = require('Module:UnitTests')
local p = require('Module:UnitTests')


-- Example unit test.
function p:test_desc()
function p:test_desc()
self:preprocess_equals('{{#invoke:Infobox sort | desc | {{#if: no | 2% Foo}} | 3% Bar | 8% Carrot}}', '8% Carrot<br>3% Bar')
self:preprocess_equals('{{#invoke:Infobox sort | desc | 2% Foo | 3% Bar | 8% Carrot}}', '8% Carrot<br>3% Bar<br>2% Foo')
end

function p:test_desc_missing_param()
self:preprocess_equals('{{#invoke:Infobox sort | desc | {{#if: | 2% Foo}} | 3% Bar | 8% Carrot}}', '8% Carrot<br>3% Bar')
end
end



Revision as of 10:59, 9 June 2020

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

function p:test_desc()
	self:preprocess_equals('{{#invoke:Infobox sort | desc | 2% Foo | 3% Bar | 8% Carrot}}', '8% Carrot<br>3% Bar<br>2% Foo')
end

function p:test_desc_missing_param()
	self:preprocess_equals('{{#invoke:Infobox sort | desc | {{#if: | 2% Foo}} | 3% Bar | 8% Carrot}}', '8% Carrot<br>3% Bar')
end

return p