Jump to content

Module:InfoboxImage/testcases

From Wikipedia, the free encyclopedia
-- Unit tests for [[Module:InfoboxImage]]. Click talk page to run tests.

local p = require('Module:UnitTests')

function p:test1_parameters_output()
    self:preprocess_equals_preprocess_many('{{#invoke:InfoboxImage |InfoboxImage |image=', '}}', '{{#invoke:InfoboxImage/sandbox |InfoboxImage |image=', '}}', {
        {'Small Sailboat Image.jpg |alt=Alt'},
        {'Small Sailboat Image.jpg |border=yes'},
        {'Small Sailboat Image.jpg |center=yes'},
        {'Small Sailboat Image.jpg |link=Link'},
        {'Small Sailboat Image.jpg |thumbtime=Thumbtime'},
        {'Small Sailboat Image.jpg |title=Title'},
        {'Small Sailboat Image.jpg |size=75'},
        {'Small Sailboat Image.jpg |size=200'},
        {'[[File:Small Sailboat Image.jpg]]'},
        {'Mustela erminea upright.jpg'},
        {'Mustela erminea upright.jpg |upright=1'},
        {'Mustela erminea upright.jpg |upright=yes'},
        {'Mustela erminea upright.jpg |upright=0.75'},
        {'Mustela erminea upright.jpg |upright=1.2'},
        {'Replace this image.svg |suppressplaceholder=no'},
        {'Replace this image.svg'},
        {'The Universal Magazine, Vol. XCV (July 1794).djvu |page=8'},
		{'[[File:Abbey Rd Studios.jpg|200px]]'},
		{'[[File:Abbey Rd Studios.jpg|thumb]]'},
		{'[[File:Abbey Rd Studios.jpg|thumb|caption]]'},
		{'Http-fakezarathustra.blogspot.com-2010-10-12 31.html http-fakezarathustra.blogspot.com-2010-10-22 31.html - panoramio.jpg'},
		{'Abbey Rd Studios.jpg|alt=http:test.com'},
		{'Abbey Rd Studios.jpg|alt=[http:test.com]'},
        {'Abbey Rd Studios.jpg|class=notpageimage'},
    })
end

function p:test2_parameters_output()
    self:preprocess_equals_preprocess_many('{{#invoke:InfoboxImage |InfoboxImage |image=', '}}', '{{#invoke:InfoboxImage/sandbox |InfoboxImage |image=', '}}', {
        {'Mustela erminea upright.jpg |size=1.2'},
    })
end

function p:test3_parameters_nowiki()
    self:preprocess_equals_preprocess_many('{{#invoke:InfoboxImage |InfoboxImage |image=', '}}', '{{#invoke:InfoboxImage/sandbox |InfoboxImage |image=', '}}', {
        {'Small Sailboat Image.jpg |alt=Alt'},
        {'Small Sailboat Image.jpg |border=yes'},
        {'Small Sailboat Image.jpg |center=yes'},
        {'Small Sailboat Image.jpg |link=Link'},
        {'Small Sailboat Image.jpg |thumbtime=Thumbtime'},
        {'Small Sailboat Image.jpg |title=Title'},
        {'Small Sailboat Image.jpg |size=75'},
        {'Small Sailboat Image.jpg |size=200'},
        {'[[File:Small Sailboat Image.jpg]]'},
        {'Mustela erminea upright.jpg'},
        {'Mustela erminea upright.jpg |upright=1'},
        {'Mustela erminea upright.jpg |upright=yes'},
        {'Mustela erminea upright.jpg |upright=0.75'},
        {'Mustela erminea upright.jpg |upright=1.2'},
        {'Mustela erminea upright.jpg |size=1.2'},
        {'Replace this image.svg |suppressplaceholder=no'},
        {'Replace this image.svg'},
        {'The Universal Magazine, Vol. XCV (July 1794).djvu |page=8'},
		{'[[File:Abbey Rd Studios.jpg|200px]]'},
		{'[[File:Abbey Rd Studios.jpg|thumb]]'},
		{'[[File:Abbey Rd Studios.jpg|thumb|caption]]'},
		{'Http-fakezarathustra.blogspot.com-2010-10-12 31.html http-fakezarathustra.blogspot.com-2010-10-22 31.html - panoramio.jpg'},
		{'http:test.com'},
		{'[http:test.com]'},
		{'[[http:test.com]]'},
		{'https:test.com'},
		{'[https:test.com]'},
		{'[[https:test.com]]'},
		{'Abbey Rd Studios.jpg|alt=http:test.com'},
		{'Abbey Rd Studios.jpg|alt=[http:test.com]'},
        {'Abbey Rd Studios.jpg|class=notpageimage'},
    },{nowiki=1})
end

function p:test4_stripmarkers()
    self:preprocess_equals_preprocess(
    	'{{#invoke:InfoboxImage |InfoboxImage |image={{multiple image | width = 60 | image1 = Yellow card.svg | image2 = Red card.svg}}}}',
    	'{{#invoke:InfoboxImage/sandbox |InfoboxImage |image={{multiple image | width = 60 | image1 = Yellow card.svg | image2 = Red card.svg}}}}',
    	{stripmarker=1})
end

return p