Jump to content

Module:Formatted appearance/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gonnym (talk | contribs) at 16:36, 18 December 2018. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Unit tests for [[Module:Formatted Appearance]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_first_generic()
	self:preprocess_equals_many('{{#invoke:Formatted Appearance|getFormattedAppearance|', '}}', {
		{'first_appearance_major_work=Arrow', '\'Arrow\'\''},
		{'first_appearance_minor_work=Pilot', 'Pilot'},
		{'first_appearance_date=October 10, 2012', 'October 10, 2012'},
		{'first_appearance_major_work=Arrow|first_appearance_minor_work=Pilot', '{{unbulleted list|Pilot|\'\'Arrow\'\'}}'},
		{'first_appearance_major_work=Arrow|first_appearance_date=October 10, 2012', '{{unbulleted list|\'\'Arrow\'\'|October 10, 2012}}'},
		{'first_appearance_minor_work=Pilot|first_appearance_date=October 10, 2012', '{{unbulleted list|Pilot|October 10, 2012}}'},
		{'first_appearance_major_work=Arrow|first_appearance_minor_work=Pilot|first_appearance_date=October 10, 2012', '{{unbulleted list|Pilot|\'\'Arrow\'\'|October 10, 2012}}'},
		{'first_appearance_major_work=[[Arrow (TV series)|Arrow]]|first_appearance_minor_work=[[Pilot (Arrow)|Pilot]]|first_appearance_date={{start date|2012|10|10}}', '{{unbulleted list|[[Pilot (Arrow)|Pilot]]|\'\'[[Arrow (TV series)|Arrow]]\'\'|{{start date|2012|10|10}}}}'},
    })
 end
 
   function p:test_last_generic()
	self:preprocess_equals_many('{{#invoke:Formatted Appearance|getFormattedAppearance|', '}}', {
		{'last_appearance_major_work=Arrow', '\'\Arrow\'\''},
		{'last_appearance_minor_work=Pilot', 'Pilot'},
		{'last_appearance_date=October 10, 2012', 'October 10, 2012'},
		{'last_appearance_major_work=Arrow|last_appearance_minor_work=Pilot', '{{unbulleted list|Pilot|\'\'Arrow\'\'}}'},
		{'last_appearance_major_work=Arrow|last_appearance_date=October 10, 2012', '{{unbulleted list|\'\'Arrow\'\'|October 10, 2012}}'},
		{'last_appearance_minor_work=Pilot|last_appearance_date=October 10, 2012', '{{unbulleted list|Pilot|October 10, 2012}}'},
		{'last_appearance_major_work=Arrow|last_appearance_minor_work=Pilot|last_appearance_date=October 10, 2012', '{{unbulleted list|Pilot|\'\'Arrow\'\'|October 10, 2012}}'},
		{'last_appearance_major_work=[[Arrow (TV series)|Arrow]]|last_appearance_minor_work=[[Pilot (Arrow)|Pilot]]|last_appearance_date={{start date|2012|10|10}}', '{{unbulleted list|[[Pilot (Arrow)|Pilot]]|\'\'[[Arrow (TV series)|Arrow]]\'\'|{{start date|2012|10|10}}}}'},
    })
end

function p:test_first_comic()
	self:preprocess_equals_many('{{#invoke:Formatted Appearance|getFormattedAppearance|', '}}', {
		{'first_appearance_major_work=The Incredible Hulk', '\'\'The Incredible Hulk\'\''},
		{'first_appearance_volume=180', ''},
		{'first_appearance_volume=#180', ''},
		{'first_appearance_date=October, 1974', 'October, 1974'},
		{'first_appearance_major_work=The Incredible Hulk|first_appearance_volume=180', '\'\'The Incredible Hulk\'\' #180'},
		{'first_appearance_major_work=The Incredible Hulk|first_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\'|October, 1974}}'},
		{'first_appearance_volume=180|first_appearance_date=October, 1974', '{{unbulleted list|#180|October, 1974}}'},
		{'first_appearance_major_work=The Incredible Hulk|first_appearance_volume=180|first_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' #180|October, 1974}}'},
		{'first_appearance_major_work=The Incredible Hulk|first_appearance_volume=Volume 180|first_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' Hulk #180|October, 1974}}'},
		{'first_appearance_major_work=The Incredible Hulk|first_appearance_volume=Volume #180|first_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' #180|October, 1974}}'},
		{'first_appearance_major_work=[[The Incredible Hulk (comic book)|The Incredible Hulk]]|first_appearance_volume=180|first_appearance_date={{start date|1974|10}}', '{{unbulleted list|\'\'[[The Incredible Hulk (comic book)|The Incredible Hulk]]\'\' #180|{{start date|1974|10}}}}'},
    })
end

function p:test_last_comic()
	self:preprocess_equals_many('{{#invoke:Formatted Appearance|getFormattedAppearance|', '}}', {
		{'last_appearance_major_work=The Incredible Hulk', '\'\'The Incredible Hulk\'\''},
		{'last_appearance_volume=180', ''},
		{'last_appearance_volume=#180', ''},
		{'last_appearance_date=October, 1974', 'October, 1974'},
		{'last_appearance_major_work=The Incredible Hulk|last_appearance_volume=180', '\'\'The Incredible Hulk\'\' #180'},
		{'last_appearance_major_work=The Incredible Hulk|last_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\'|October, 1974}}'},
		{'last_appearance_volume=180|last_appearance_date=October, 1974', '{{unbulleted list|#180|October, 1974}}'},
		{'last_appearance_major_work=The Incredible Hulk|last_appearance_volume=180|last_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' #180|October, 1974}}'},
		{'last_appearance_major_work=The Incredible Hulk|last_appearance_volume=Volume 180|last_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' #180|October, 1974}}'},
		{'last_appearance_major_work=The Incredible Hulk|last_appearance_volume=Volume #180|last_appearance_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' #180|October, 1974}}'},
		{'last_appearance_major_work=[[The Incredible Hulk (comic book)|The Incredible Hulk]]|last_appearance_volume=180|last_appearance_date={{start date|1974|10}}', '{{unbulleted list|\'\'[[The Incredible Hulk (comic book)|The Incredible Hulk]]\'\' #180|{{start date|1974|10}}}}'},
    })
end

return p