Jump to content

Module:Wikipedia ads/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
testcases
 
make tests actually compare with sandbox without randomness
Line 3: Line 3:
function p:test_hello()
function p:test_hello()
self:preprocess_equals_preprocess('{{wikipedia ads|ad=4}}', '{{wikipedia ads||4}}')
self:preprocess_equals_preprocess('{{wikipedia ads|ad=175}}', '{{wikipedia ads/sandbox|ad=175}}')
self:preprocess_equals_preprocess('{{wikipedia ads/sandbox|ad=4}}', '{{wikipedia ads/sandbox||4}}')
self:preprocess_equals_preprocess('{{wikipedia ads||175}}', '{{wikipedia ads/sandbox||175}}')
self:preprocess_equals_preprocess('{{wikipedia ads|ad=9|linkcolor=red|color=blue|background=yellow}}', '{{wikipedia ads/sandbox|ad=9|linkcolor=red|color=blue|background=yellow}}')
self:preprocess_equals_preprocess('{{wikipedia ads|ad=175|linkcolor=red|color=blue|background=yellow}}', '{{wikipedia ads/sandbox|ad=175|linkcolor=red|color=blue|background=yellow}}')
self:preprocess_equals_preprocess('{{wikipedia ads|ad=9}}', '{{wikipedia ads/sandbox|ad=9}}')
self:preprocess_equals_preprocess('{{wikipedia ads|ad=175}}', '{{wikipedia ads/sandbox|ad=175}}')
self:preprocess_equals_preprocess('{{wikipedia ads|navbox=yes}}', '{{wikipedia ads/sandbox|navbox=yes}}')
self:preprocess_equals_preprocess('{{wikipedia ads|ad=175|navbox=yes}}', '{{wikipedia ads/sandbox|ad=175|navbox=yes}}')
end
end

Revision as of 15:56, 11 June 2023

-- Unit tests for [[Module:Wikipedia ads]]. Click talk page to run tests.
local p = require('Module:UnitTests')
 
function p:test_hello()
    self:preprocess_equals_preprocess('{{wikipedia ads|ad=175}}', '{{wikipedia ads/sandbox|ad=175}}')
    self:preprocess_equals_preprocess('{{wikipedia ads||175}}', '{{wikipedia ads/sandbox||175}}')
    self:preprocess_equals_preprocess('{{wikipedia ads|ad=175|linkcolor=red|color=blue|background=yellow}}', '{{wikipedia ads/sandbox|ad=175|linkcolor=red|color=blue|background=yellow}}')
    self:preprocess_equals_preprocess('{{wikipedia ads|ad=175}}', '{{wikipedia ads/sandbox|ad=175}}')
    self:preprocess_equals_preprocess('{{wikipedia ads|ad=175|navbox=yes}}', '{{wikipedia ads/sandbox|ad=175|navbox=yes}}')
end
 
return p