Module:DateI18n/timef test

From Islamical Commons
Jump to navigation Jump to search

Documentation for this module may be created at Module:DateI18n/timef test/doc

local p = require('Module:UnitTests')

function p:test_1_English_language()
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2009|month=12|day=09|hour=13|minute=20|lang=en}}', '{{#timef:2009-12-09T13:20:17|both|en}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2009|month=01|day=09|lang=en}}', '{{#timef:2009-01-09|date|en}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=12|day=09|lang=en}}', '{{#timef:2009-12-09|pretty|en}}')
end

function p:test_2_YMD_format()
	self:preprocess_equals_preprocess_many(
		'{{#invoke:DateI18n|Date|year=2024|month=09|day=12|lang=', '}}',
		'{{#timef:2024-09-12|date|', '}}', {
			{'be'},
			{'be-x-old'},
			{'bn'},
			{'bpy'},
			{'ca'},
			{'ce'},
			{'ckb'},
			{'cs'},
			{'da'},
			{'de'},
			{'el'},
			{'en'},
			{'eo'},
			{'es'},
			{'et'},
			{'eu'},
			{'fa'},
			{'fi'},
			{'fr'},
			{'ga'},
			{'gl'},
			{'he'},
			{'hi'},
			{'hr'},
			{'hsb'},
			{'hu'},
			{'ia'},
			{'is'},
			{'it'},
			{'ja'},
			{'kn'},
			{'ko'},
			{'lt'},
			{'lv'},
			{'mk'},
			{'ml'},
			{'mr'},
			{'new'},
			{'nn'},
			{'no'},
			{'oc'},
			{'pa'},
			{'pl'},
			{'pt'},
			{'qu'},
			{'qug'},
			{'ru'},
			{'sk'},
			{'sl'},
			{'sr'},
			{'th'},
			{'uk'},
			{'vi'},
			{'yue'},
			{'zh-hans'}
	} )
end

function p:test_3_MD_format()
	self:preprocess_equals_preprocess_many(
		'{{#invoke:DateI18n|Date|month=11|day=12|lang=', '}}',
		'{{#timef:0000-11-12|pretty|', '}}', {
			{'be'},
			{'be-x-old'},
			{'bn'},
			{'bpy'},
			{'ca'},
			{'ce'},
			{'ckb'},
			{'cs'},
			{'da'},
			{'de'},
			{'el'},
			{'en'},
			{'eo'},
			{'es'},
			{'et'},
			{'eu'},
			{'fa'},
			{'fi'},
			{'fr'},
			{'ga'},
			{'gl'},
			{'he'},
			{'hi'},
			{'hr'},
			{'hsb'},
			{'hu'},
			{'ia'},
			{'is'},
			{'it'},
			{'ja'},
			{'kn'},
			{'ko'},
			{'lt'},
			{'lv'},
			{'mk'},
			{'ml'},
			{'mr'},
			{'new'},
			{'nn'},
			{'no'},
			{'oc'},
			{'pa'},
			{'pl'},
			{'pt'},
			{'qu'},
			{'qug'},
			{'ru'},
			{'sk'},
			{'sl'},
			{'sr'},
			{'th'},
			{'uk'},
			{'vi'},
			{'yue'},
			{'zh-hans'}
	} )
end

function p:test_4_YMDhm_format()
	self:preprocess_equals_preprocess_many(
		'{{#invoke:DateI18n|Date|year=2009|month=12|day=09|hour=13|minute=20|lang=', '}}',
		'{{#timef:2009-12-09T13:20:17|both|', '}}', {
			{'be'},
			{'be-x-old'},
			{'bn'},
			{'bpy'},
			{'ca'},
			{'ce'},
			{'ckb'},
			{'cs'},
			{'da'},
			{'de'},
			{'el'},
			{'en'},
			{'eo'},
			{'es'},
			{'et'},
			{'eu'},
			{'fa'},
			{'fi'},
			{'fr'},
			{'ga'},
			{'gl'},
			{'he'},
			{'hi'},
			{'hr'},
			{'hsb'},
			{'hu'},
			{'ia'},
			{'is'},
			{'it'},
			{'ja'},
			{'kn'},
			{'ko'},
			{'lt'},
			{'lv'},
			{'mk'},
			{'ml'},
			{'mr'},
			{'new'},
			{'nn'},
			{'no'},
			{'oc'},
			{'pa'},
			{'pl'},
			{'pt'},
			{'qu'},
			{'qug'},
			{'ru'},
			{'sk'},
			{'sl'},
			{'sr'},
			{'th'},
			{'uk'},
			{'vi'},
			{'yue'},
			{'zh-hans'}
	} )
end


function p:test_6_Romance_languages()
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=09|day=01|lang=fr}}', '{{#timef:2024-09-01|date|fr}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=09|day=02|lang=fr}}', '{{#timef:2024-09-02|date|fr}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=08|day=02|lang=fr}}', '{{#timef:2024-08-02|pretty|fr}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=08|day=01|lang=fr}}', '{{#timef:2024-08-01|pretty|fr}}')
	
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=08|day=01|lang=ga}}', '{{#timef:2024-08-01|date|ga}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=08|day=02|lang=ga}}', '{{#timef:2024-08-02|date|ga}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=07|day=02|lang=ga}}', '{{#timef:2024-07-02|pretty|ga}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=07|day=01|lang=ga}}', '{{#timef:2024-07-01|pretty|ga}}')
	
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=07|day=01|lang=ca}}', '{{#timef:2024-07-01|date|ca}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=07|day=02|lang=ca}}', '{{#timef:2024-07-02|date|ca}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=06|day=02|lang=ca}}', '{{#timef:2024-06-02|pretty|ca}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=06|day=01|lang=ca}}', '{{#timef:2024-06-01|pretty|ca}}')
	
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=04|day=01|lang=eu}}', '{{#timef:2024-04-01|date|eu}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=04|day=02|lang=eu}}', '{{#timef:2024-04-02|date|eu}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=03|day=11|lang=eu}}', '{{#timef:2024-03-11|date|eu}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=02|day=21|lang=eu}}', '{{#timef:2024-02-21|date|eu}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2024|month=01|day=31|lang=eu}}', '{{#timef:2024-01-31|date|eu}}')
end

function p:test_7_Quechua_language()
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2009|month=01|day=09|lang=qu}}', '{{#timef:2009-01-09|date|qu}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=12|day=09|lang=qu}}', '{{#timef:0000-12-09|pretty|qu}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2009|month=01|day=09|lang=qug}}', '{{#timef:2009-01-09|date|qug}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=12|day=09|lang=qug}}', '{{#timef:0000-12-09|pretty|qug}}')
end

function p:test_8_Thai_solar_calendar()
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|year=2009|month=01|day=09|lang=th}}', '{{#timef:2009-01-09|date|th}}')
	self:preprocess_equals_preprocess('{{#invoke:DateI18n|Date|month=12|day=09|lang=th}}', '{{#timef:0000-12-09|pretty|th}}')
end

return p