跳转到内容

模組:InfoboxImage/testcases

维基百科,自由的百科全书
-- 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'},
        {'Mustela erminea upright.jpg |size=1.2'},
        {'No free image (camera).svg |suppressplaceholder=no'},
        {'No free image (camera).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_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'},
        {'No free image (camera).svg |suppressplaceholder=no'},
        {'No free image (camera).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

return p