Module:Fallback/tests/fallbacks

From PsychonautWiki
Jump to: navigation, search

Documentation for this module may be created at Module:Fallback/tests/fallbacks/doc

return {
	--[========[
	Note: optional results mapped as 'better' or 'best' are used in the sandbox version,
	to test improved results that are currently expected in the non-sandboxed version.
	Ideally the 'best' version should be expected and should be reached by the sandbox
	version of these tests. Once they pass, elimitate the xurrently 'expected' version
	and use the current 'better' version or 'best' version to be the one expected.
	
	The runTests() method should accept any one of them these results but should log its
	status, but the non-sandboxed version currently only acceptd the expected one, and
	will incorrectly return a final FAILURE instead of a WARNING if the result is not
	the 'best' one.
	--]========]
	{
		initial  = 'en',
		expected = {'en','default','en'},
		best     = {'en','default'},
	}, {
		initial  = 'en-us',
		expected = {'en-us','default','en'}, -- incorrect order, missing BC47 parsing of subtags
		best     = {'en-us','en','default'},
	}, {
		initial  = 'en-dsrt-us',
		expected = {'en-dsrt-us','default','en'}, -- incorrect order, missing BC47 parsing of subtags
		better   = {'en-dsrt-us','en','default'}, -- missing BC47 parsing of subtags
		best     = {'en-dsrt-us','en-dsrt','en','default'}, -- with BCP47 parsing of singleton subtags
	}, {
		initial  = 'en-dsrt-us-x-source',
		expected = {'en-dsrt-us-x-source', 'default', 'en'},  -- incorrect order
		better   = {'en-dsrt-us-x-source','en-dsrt-us-x','en-dsrt-us','en-dsrt','en','default'}, -- no dulicate but missing BC47 parsing of singleton subtags
		best     = {'en-dsrt-us-x-source','en-dsrt-us','en-dsrt','en','default'}, -- no duplicate, with BCP47 parsing of singleton subtags
	}, {
		initial  = 'en-gb',
		expected = {'en-gb','en','default','en'},
		best     = {'en-gb','en','default'},
	}, {
		initial  = 'en-GB',
		expected = {'en-gb','en','default', 'en'},
		best     = {'en-gb','en','default'},
	}, {
		initial  = 'co-it',
		expected = {'co-it','default','en'}, -- missing BCP47 parsing of subtags
		better   = {'co-it','co','fr','default','en'}, -- without fallback of 'co-it' defined, but with fallback of 'co' defined as 'fr'
		best     = {'co-it','co','it','fr','default','en'}, -- with fallbacks of 'co-it' defined as 'co','it'
	}, {
		initial  = 'als',
		expected = {'als','gsw','de','default','en'},
	}, {
		initial  = 'als',
		expected = {'als','gsw','de','default','en'},
	}, {
		initial  = 'de-ch',
		expected = {'de-ch','de','default','en'},
	}, {
		initial  = 'gan',
		expected = {'gan','gan-hant','zh-hant','zh','zh-hans','zh-cn','default','en'},
	}, {
		initial  = 'crh',
		expected = {'crh','crh-latn','default','en'},
	}
}