Jump to content

Module:Webarchive/sandbox/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
first of template examples
remaining template examples
Line 11: Line 11:
function p:test_Template_Examples()
function p:test_Template_Examples()
self:preprocess_equals_many('{{#invoke:webarchive/sandbox|webarchive', '}}', {
self:preprocess_equals_many('{{#invoke:webarchive/sandbox|webarchive', '}}', {
{'|url=https://web.archive.org/web/20160801000000/http://example.com |date=August 1, 2016 |title=Page title', '[https://web.archive.org/web/20160801000000/http://example.com Page title] at the [[Wayback Machine]] (archived August 1, 2016)[[Category:Webarchive template wayback links]]'},
{'|url=https://web.archive.org/web/20160801000000/http://example.com |date=August 1, 2016 |title=Page title',
'[https://web.archive.org/web/20160801000000/http://example.com Page title] at the [[Wayback Machine]] (archived August 1, 2016)[[Category:Webarchive template wayback links]]'},
{'|url=https://web.archive.org/web/20160801000000/http://example.com |date=August 1, 2016',
'[https://web.archive.org/web/20160801000000/http://example.com Archived] August 1, 2016, at the [[Wayback Machine]].[[Category:Webarchive template wayback links]]'},
{'|url=http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/',
'[http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ Archived] 2012-05-26 at [[WebCite]][[Category:Webarchive template webcite links]]'},
{'|url=https://web.archive.org/web/20160801/http://example.com |title=Page title |date=August 1, 2016 |url2=https://web.archive.org/web/20160901/http://example.com |title2=Page2 title |date2=September 1, 2016',
'[https://web.archive.org/web/20160801/http://example.com Page title] at the [[Wayback Machine]] (archived August 1, 2016). Additional archives: [https://web.archive.org/web/20160901/http://example.com Page2 title].[[Category:Webarchive template wayback links]]'},
{'|url=https://web.archive.org/web/20160801/http://example.com |date=August 1, 2016 |url2=https://web.archive.org/web/20160901/http://example.com |date2=September 1, 2016',
'[https://web.archive.org/web/20160801/http://example.com Archived] August 1, 2016, at the [[Wayback Machine]]. Additional archives: [https://web.archive.org/web/20160901/http://example.com September 1, 2016].[[Category:Webarchive template wayback links]]'},
{'|url=https://web.archive.org/web/20160801/http://example.com |title=Page title |url2=https://web.archive.org/web/20160901/http://example.com |title2=Page2 title',
'[https://web.archive.org/web/20160801/http://example.com Page title] at the [[Wayback Machine]] (archived 2016-08-01). Additional archives: [https://web.archive.org/web/20160901/http://example.com Page2 title].[[Category:Webarchive template wayback links]]'},
} )
} )
end
end

Revision as of 17:43, 15 November 2016

local p = require('Module:UnitTests')

function p:test_Usage_Examples()
	self:preprocess_equals_many('{{#invoke:webarchive/sandbox|webarchive', '}}', {
		 {'|url=https://web.archive.org/web/20160801000000/http://example.com |date=August 1, 2016', '[https://web.archive.org/web/20160801000000/http://example.com Archived] August 1, 2016, at the [[Wayback Machine]].[[Category:Webarchive template wayback links]]'},
		 {'|url=http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |date=12 February 2009 ', '[http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ Archived] 12 February 2009 at [[WebCite]][[Category:Webarchive template webcite links]]'},
		 {'|url=http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ |date=12 February 2009 |title=Page title', '[http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ Page title] at [[WebCite]] (archived 12 February 2009)[[Category:Webarchive template webcite links]]'},
	} )
end

function p:test_Template_Examples()
	self:preprocess_equals_many('{{#invoke:webarchive/sandbox|webarchive', '}}', {
		 {'|url=https://web.archive.org/web/20160801000000/http://example.com |date=August 1, 2016 |title=Page title',
		 	'[https://web.archive.org/web/20160801000000/http://example.com Page title] at the [[Wayback Machine]] (archived August 1, 2016)[[Category:Webarchive template wayback links]]'},
		 {'|url=https://web.archive.org/web/20160801000000/http://example.com |date=August 1, 2016',
		 	'[https://web.archive.org/web/20160801000000/http://example.com Archived] August 1, 2016, at the [[Wayback Machine]].[[Category:Webarchive template wayback links]]'},
		 {'|url=http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/',
		 	'[http://www.webcitation.org/5eWaHRbn4?url=http://www.example.com/ Archived] 2012-05-26 at [[WebCite]][[Category:Webarchive template webcite links]]'},
		 {'|url=https://web.archive.org/web/20160801/http://example.com |title=Page title |date=August 1, 2016 |url2=https://web.archive.org/web/20160901/http://example.com |title2=Page2 title |date2=September 1, 2016', 
		 	'[https://web.archive.org/web/20160801/http://example.com Page title] at the [[Wayback Machine]] (archived August 1, 2016). Additional archives: [https://web.archive.org/web/20160901/http://example.com Page2 title].[[Category:Webarchive template wayback links]]'},
		 {'|url=https://web.archive.org/web/20160801/http://example.com |date=August 1, 2016 |url2=https://web.archive.org/web/20160901/http://example.com |date2=September 1, 2016', 
		 	'[https://web.archive.org/web/20160801/http://example.com Archived] August 1, 2016, at the [[Wayback Machine]]. Additional archives: [https://web.archive.org/web/20160901/http://example.com September 1, 2016].[[Category:Webarchive template wayback links]]'},
		 {'|url=https://web.archive.org/web/20160801/http://example.com |title=Page title |url2=https://web.archive.org/web/20160901/http://example.com |title2=Page2 title', 
		 	'[https://web.archive.org/web/20160801/http://example.com Page title] at the [[Wayback Machine]] (archived 2016-08-01). Additional archives: [https://web.archive.org/web/20160901/http://example.com Page2 title].[[Category:Webarchive template wayback links]]'},
	} )
end


return p