Module:Fallback/sandbox/testcases

-- Unit tests for Module:Fallback/sandbox. Click talk page to run tests. local p = require('Module:UnitTests') local fallback = require('Module:Fallback/sandbox')

function has(list, value) for _, v in ipairs(list) do		if v == value then return true end end return false end

function remove(list, value) for k, v in ipairs(list) do		if v == value then table.remove(list, k)		end end end

function locallist(langcode) -- actual local list = fallback.fblist(langcode) return mw.text.listToText(list) end

function mwlist(langcode) -- expected(?) local list = mw.language.getFallbacksFor(langcode) -- Modifications in order to compare successfully with actual in most cases: -- 1. Remove English completely if English is not requested. if langcode ~= 'en' and langcode:match('^en%-') == nil then remove(list, 'en') end -- 2. add or move the code of the language itself to the top remove(list, langcode) table.insert(list, 1, langcode) -- 3. add 'default' at end table.insert(list, 'default') -- this must come before 'en' -- 4. add 'en' after 'default', if 'en' was removed in step 1 if not has(list, 'en') then table.insert(list, 'en') -- this must come last after 'default' end return mw.text.listToText(list) end

function p:test_fallbacks --        (lang, actual, expected) self:equals('aa', locallist('aa'), mwlist('aa')) self:equals('ab', locallist('ab'), mwlist('ab')) self:equals('ace', locallist('ace'), mwlist('ace')) self:equals('af', locallist('af'), mwlist('af')) self:equals('ak', locallist('ak'), mwlist('ak')) self:equals('aln', locallist('aln'), mwlist('aln')) self:equals('als', locallist('als'), mwlist('als')) self:equals('am', locallist('am'), mwlist('am')) self:equals('an', locallist('an'), mwlist('an')) self:equals('ang', locallist('ang'), mwlist('ang')) self:equals('anp', locallist('anp'), mwlist('anp')) self:equals('ar', locallist('ar'), mwlist('ar')) self:equals('arc', locallist('arc'), mwlist('arc')) self:equals('arn', locallist('arn'), mwlist('arn')) self:equals('ary', locallist('ary'), mwlist('ary')) self:equals('arz', locallist('arz'), mwlist('arz')) self:equals('as', locallist('as'), mwlist('as')) self:equals('ast', locallist('ast'), mwlist('ast')) self:equals('av', locallist('av'), mwlist('av')) self:equals('avk', locallist('avk'), mwlist('avk')) self:equals('ay', locallist('ay'), mwlist('ay')) self:equals('az', locallist('az'), mwlist('az')) self:equals('azb', locallist('azb'), mwlist('azb')) self:equals('ba', locallist('ba'), mwlist('ba')) self:equals('bar', locallist('bar'), mwlist('bar')) self:equals('bat-smg', locallist('bat-smg'), mwlist('bat-smg')) self:equals('bbc', locallist('bbc'), mwlist('bbc')) self:equals('bbc-latn', locallist('bbc-latn'), mwlist('bbc-latn')) self:equals('bcc', locallist('bcc'), mwlist('bcc')) self:equals('bcl', locallist('bcl'), mwlist('bcl')) self:equals('be', locallist('be'), mwlist('be')) self:equals('be-tarask', locallist('be-tarask'), mwlist('be-tarask')) self:equals('be-x-old', locallist('be-x-old'), mwlist('be-x-old')) self:equals('bg', locallist('bg'), mwlist('bg')) self:equals('bh', locallist('bh'), mwlist('bh')) self:equals('bho', locallist('bho'), mwlist('bho')) self:equals('bi', locallist('bi'), mwlist('bi')) self:equals('bjn', locallist('bjn'), mwlist('bjn')) self:equals('bm', locallist('bm'), mwlist('bm')) self:equals('bn', locallist('bn'), mwlist('bn')) self:equals('bo', locallist('bo'), mwlist('bo')) self:equals('bpy', locallist('bpy'), mwlist('bpy')) self:equals('bqi', locallist('bqi'), mwlist('bqi')) self:equals('br', locallist('br'), mwlist('br')) self:equals('brh', locallist('brh'), mwlist('brh')) self:equals('bs', locallist('bs'), mwlist('bs')) self:equals('bug', locallist('bug'), mwlist('bug')) self:equals('bxr', locallist('bxr'), mwlist('bxr')) self:equals('ca', locallist('ca'), mwlist('ca')) self:equals('cbk-zam', locallist('cbk-zam'), mwlist('cbk-zam')) self:equals('cdo', locallist('cdo'), mwlist('cdo')) self:equals('ce', locallist('ce'), mwlist('ce')) self:equals('ceb', locallist('ceb'), mwlist('ceb')) self:equals('ch', locallist('ch'), mwlist('ch')) self:equals('cho', locallist('cho'), mwlist('cho')) self:equals('chr', locallist('chr'), mwlist('chr')) self:equals('chy', locallist('chy'), mwlist('chy')) self:equals('ckb', locallist('ckb'), mwlist('ckb')) self:equals('co', locallist('co'), mwlist('co')) self:equals('co-fr', locallist('co-fr'), mwlist('co-fr')) self:equals('co-it', locallist('co-it'), mwlist('co-it')) self:equals('cps', locallist('cps'), mwlist('cps')) self:equals('cr', locallist('cr'), mwlist('cr')) self:equals('crh', locallist('crh'), mwlist('crh')) self:equals('crh-latn', locallist('crh-latn'), mwlist('crh-latn')) self:equals('crh-cyrl', locallist('crh-cyrl'), mwlist('crh-cyrl')) self:equals('cs', locallist('cs'), mwlist('cs')) self:equals('csb', locallist('csb'), mwlist('csb')) self:equals('cu', locallist('cu'), mwlist('cu')) self:equals('cv', locallist('cv'), mwlist('cv')) self:equals('cy', locallist('cy'), mwlist('cy')) self:equals('da', locallist('da'), mwlist('da')) self:equals('de', locallist('de'), mwlist('de')) self:equals('de-at', locallist('de-at'), mwlist('de-at')) self:equals('de-ch', locallist('de-ch'), mwlist('de-ch')) self:equals('de-formal', locallist('de-formal'), mwlist('de-formal')) self:equals('diq', locallist('diq'), mwlist('diq')) self:equals('dsb', locallist('dsb'), mwlist('dsb')) self:equals('dtp', locallist('dtp'), mwlist('dtp')) self:equals('dv', locallist('dv'), mwlist('dv')) self:equals('dz', locallist('dz'), mwlist('dz')) self:equals('ee', locallist('ee'), mwlist('ee')) self:equals('egl', locallist('egl'), mwlist('egl')) self:equals('el', locallist('el'), mwlist('el')) self:equals('eml', locallist('eml'), mwlist('eml')) self:equals('en', locallist('en'), mwlist('en')) self:equals('en-ca', locallist('en-ca'), mwlist('en-ca')) self:equals('en-gb', locallist('en-gb'), mwlist('en-gb')) self:equals('en-in', locallist('en-in'), mwlist('en-in')) self:equals('en-us', locallist('en-us'), mwlist('en-us')) self:equals('en-za', locallist('en-za'), mwlist('en-za')) self:equals('eo', locallist('eo'), mwlist('eo')) self:equals('es', locallist('es'), mwlist('es')) self:equals('et', locallist('et'), mwlist('et')) self:equals('eu', locallist('eu'), mwlist('eu')) self:equals('ext', locallist('ext'), mwlist('ext')) self:equals('fa', locallist('fa'), mwlist('fa')) self:equals('ff', locallist('ff'), mwlist('ff')) self:equals('fi', locallist('fi'), mwlist('fi')) self:equals('fit', locallist('fit'), mwlist('fit')) self:equals('fiu-vro', locallist('fiu-vro'), mwlist('fiu-vro')) self:equals('fj', locallist('fj'), mwlist('fj')) self:equals('fo', locallist('fo'), mwlist('fo')) self:equals('fr', locallist('fr'), mwlist('fr')) self:equals('frc', locallist('frc'), mwlist('frc')) self:equals('frp', locallist('frp'), mwlist('frp')) self:equals('frr', locallist('frr'), mwlist('frr')) self:equals('fur', locallist('fur'), mwlist('fur')) self:equals('fy', locallist('fy'), mwlist('fy')) self:equals('ga', locallist('ga'), mwlist('ga')) self:equals('gag', locallist('gag'), mwlist('gag')) self:equals('gan', locallist('gan'), mwlist('gan')) self:equals('gan-hans', locallist('gan-hans'), mwlist('gan-hans')) self:equals('gan-hant', locallist('gan-hant'), mwlist('gan-hant')) self:equals('gd', locallist('gd'), mwlist('gd')) self:equals('gl', locallist('gl'), mwlist('gl')) self:equals('glk', locallist('glk'), mwlist('glk')) self:equals('gn', locallist('gn'), mwlist('gn')) self:equals('gom-latn', locallist('gom-latn'), mwlist('gom-latn')) self:equals('got', locallist('got'), mwlist('got')) self:equals('grc', locallist('grc'), mwlist('grc')) self:equals('gsw', locallist('gsw'), mwlist('gsw')) self:equals('gu', locallist('gu'), mwlist('gu')) self:equals('gv', locallist('gv'), mwlist('gv')) self:equals('ha', locallist('ha'), mwlist('ha')) self:equals('hak', locallist('hak'), mwlist('hak')) self:equals('haw', locallist('haw'), mwlist('haw')) self:equals('he', locallist('he'), mwlist('he')) self:equals('hi', locallist('hi'), mwlist('hi')) self:equals('hif', locallist('hif'), mwlist('hif')) self:equals('hif-latn', locallist('hif-latn'), mwlist('hif-latn')) self:equals('hil', locallist('hil'), mwlist('hil')) self:equals('ho', locallist('ho'), mwlist('ho')) self:equals('hr', locallist('hr'), mwlist('hr')) self:equals('hsb', locallist('hsb'), mwlist('hsb')) self:equals('ht', locallist('ht'), mwlist('ht')) self:equals('hu', locallist('hu'), mwlist('hu')) self:equals('hy', locallist('hy'), mwlist('hy')) self:equals('hz', locallist('hz'), mwlist('hz')) self:equals('ia', locallist('ia'), mwlist('ia')) self:equals('id', locallist('id'), mwlist('id')) self:equals('ie', locallist('ie'), mwlist('ie')) self:equals('ig', locallist('ig'), mwlist('ig')) self:equals('ii', locallist('ii'), mwlist('ii')) self:equals('ik', locallist('ik'), mwlist('ik')) self:equals('ike-cans', locallist('ike-cans'), mwlist('ike-cans')) self:equals('ike-latn', locallist('ike-latn'), mwlist('ike-latn')) self:equals('ilo', locallist('ilo'), mwlist('ilo')) self:equals('inh', locallist('inh'), mwlist('inh')) self:equals('io', locallist('io'), mwlist('io')) self:equals('is', locallist('is'), mwlist('is')) self:equals('it', locallist('it'), mwlist('it')) self:equals('iu', locallist('iu'), mwlist('iu')) self:equals('ja', locallist('ja'), mwlist('ja')) self:equals('jam', locallist('jam'), mwlist('jam')) self:equals('jbo', locallist('jbo'), mwlist('jbo')) self:equals('jut', locallist('jut'), mwlist('jut')) self:equals('jv', locallist('jv'), mwlist('jv')) self:equals('ka', locallist('ka'), mwlist('ka')) self:equals('kaa', locallist('kaa'), mwlist('kaa')) self:equals('kab', locallist('kab'), mwlist('kab')) self:equals('kbd', locallist('kbd'), mwlist('kbd')) self:equals('kbd-cyrl', locallist('kbd-cyrl'), mwlist('kbd-cyrl')) self:equals('kg', locallist('kg'), mwlist('kg')) self:equals('khw', locallist('khw'), mwlist('khw')) self:equals('ki', locallist('ki'), mwlist('ki')) self:equals('kiu', locallist('kiu'), mwlist('kiu')) self:equals('kj', locallist('kj'), mwlist('kj')) self:equals('kk', locallist('kk'), mwlist('kk')) self:equals('kk-arab', locallist('kk-arab'), mwlist('kk-arab')) self:equals('kk-cyrl', locallist('kk-cyrl'), mwlist('kk-cyrl')) self:equals('kk-latn', locallist('kk-latn'), mwlist('kk-latn')) self:equals('kk-cn', locallist('kk-cn'), mwlist('kk-cn')) self:equals('kk-kz', locallist('kk-kz'), mwlist('kk-kz')) self:equals('kk-tr', locallist('kk-tr'), mwlist('kk-tr')) self:equals('kl', locallist('kl'), mwlist('kl')) self:equals('km', locallist('km'), mwlist('km')) self:equals('kn', locallist('kn'), mwlist('kn')) self:equals('ko', locallist('ko'), mwlist('ko')) self:equals('ko-kp', locallist('ko-kp'), mwlist('ko-kp')) self:equals('koi', locallist('koi'), mwlist('koi')) self:equals('kr', locallist('kr'), mwlist('kr')) self:equals('krc', locallist('krc'), mwlist('krc')) self:equals('kri', locallist('kri'), mwlist('kri')) self:equals('krj', locallist('krj'), mwlist('krj')) self:equals('ks', locallist('ks'), mwlist('ks')) self:equals('ks-arab', locallist('ks-arab'), mwlist('ks-arab')) self:equals('ks-deva', locallist('ks-deva'), mwlist('ks-deva')) self:equals('ksh', locallist('ksh'), mwlist('ksh')) self:equals('ku', locallist('ku'), mwlist('ku')) self:equals('ku-latn', locallist('ku-latn'), mwlist('ku-latn')) self:equals('ku-arab', locallist('ku-arab'), mwlist('ku-arab')) self:equals('kv', locallist('kv'), mwlist('kv')) self:equals('kw', locallist('kw'), mwlist('kw')) self:equals('ky', locallist('ky'), mwlist('ky')) self:equals('la', locallist('la'), mwlist('la')) self:equals('lad', locallist('lad'), mwlist('lad')) self:equals('lb', locallist('lb'), mwlist('lb')) self:equals('lbe', locallist('lbe'), mwlist('lbe')) self:equals('lez', locallist('lez'), mwlist('lez')) self:equals('lfn', locallist('lfn'), mwlist('lfn')) self:equals('lg', locallist('lg'), mwlist('lg')) self:equals('li', locallist('li'), mwlist('li')) self:equals('lij', locallist('lij'), mwlist('lij')) self:equals('liv', locallist('liv'), mwlist('liv')) self:equals('lmo', locallist('lmo'), mwlist('lmo')) self:equals('ln', locallist('ln'), mwlist('ln')) self:equals('lo', locallist('lo'), mwlist('lo')) self:equals('lrc', locallist('lrc'), mwlist('lrc')) self:equals('loz', locallist('loz'), mwlist('loz')) self:equals('lt', locallist('lt'), mwlist('lt')) self:equals('ltg', locallist('ltg'), mwlist('ltg')) self:equals('lus', locallist('lus'), mwlist('lus')) self:equals('lv', locallist('lv'), mwlist('lv')) self:equals('lzh', locallist('lzh'), mwlist('lzh')) self:equals('lzz', locallist('lzz'), mwlist('lzz')) self:equals('mai', locallist('mai'), mwlist('mai')) self:equals('map-bms', locallist('map-bms'), mwlist('map-bms')) self:equals('mdf', locallist('mdf'), mwlist('mdf')) self:equals('mg', locallist('mg'), mwlist('mg')) self:equals('mh', locallist('mh'), mwlist('mh')) self:equals('mhr', locallist('mhr'), mwlist('mhr')) self:equals('mi', locallist('mi'), mwlist('mi')) self:equals('min', locallist('min'), mwlist('min')) self:equals('mk', locallist('mk'), mwlist('mk')) self:equals('ml', locallist('ml'), mwlist('ml')) self:equals('mn', locallist('mn'), mwlist('mn')) self:equals('mo', locallist('mo'), mwlist('mo')) self:equals('mr', locallist('mr'), mwlist('mr')) self:equals('mrj', locallist('mrj'), mwlist('mrj')) self:equals('ms', locallist('ms'), mwlist('ms')) self:equals('mt', locallist('mt'), mwlist('mt')) self:equals('mus', locallist('mus'), mwlist('mus')) self:equals('mwl', locallist('mwl'), mwlist('mwl')) self:equals('my', locallist('my'), mwlist('my')) self:equals('myv', locallist('myv'), mwlist('myv')) self:equals('mzn', locallist('mzn'), mwlist('mzn')) self:equals('na', locallist('na'), mwlist('na')) self:equals('nah', locallist('nah'), mwlist('nah')) self:equals('nan', locallist('nan'), mwlist('nan')) self:equals('nap', locallist('nap'), mwlist('nap')) self:equals('nb', locallist('nb'), mwlist('nb')) self:equals('nds', locallist('nds'), mwlist('nds')) self:equals('nds-nl', locallist('nds-nl'), mwlist('nds-nl')) self:equals('ne', locallist('ne'), mwlist('ne')) self:equals('new', locallist('new'), mwlist('new')) self:equals('ng', locallist('ng'), mwlist('ng')) self:equals('niu', locallist('niu'), mwlist('niu')) self:equals('nl', locallist('nl'), mwlist('nl')) self:equals('nl-informal', locallist('nl-informal'), mwlist('nl-informal')) self:equals('nn', locallist('nn'), mwlist('nn')) self:equals('no', locallist('no'), mwlist('no')) self:equals('nov', locallist('nov'), mwlist('nov')) self:equals('nrm', locallist('nrm'), mwlist('nrm')) self:equals('nso', locallist('nso'), mwlist('nso')) self:equals('nv', locallist('nv'), mwlist('nv')) self:equals('ny', locallist('ny'), mwlist('ny')) self:equals('oc', locallist('oc'), mwlist('oc')) self:equals('om', locallist('om'), mwlist('om')) self:equals('or', locallist('or'), mwlist('or')) self:equals('os', locallist('os'), mwlist('os')) self:equals('pa', locallist('pa'), mwlist('pa')) self:equals('pag', locallist('pag'), mwlist('pag')) self:equals('pam', locallist('pam'), mwlist('pam')) self:equals('pap', locallist('pap'), mwlist('pap')) self:equals('pcd', locallist('pcd'), mwlist('pcd')) self:equals('pdc', locallist('pdc'), mwlist('pdc')) self:equals('pdt', locallist('pdt'), mwlist('pdt')) self:equals('pfl', locallist('pfl'), mwlist('pfl')) self:equals('pi', locallist('pi'), mwlist('pi')) self:equals('pih', locallist('pih'), mwlist('pih')) self:equals('pl', locallist('pl'), mwlist('pl')) self:equals('pms', locallist('pms'), mwlist('pms')) self:equals('pnb', locallist('pnb'), mwlist('pnb')) self:equals('pnt', locallist('pnt'), mwlist('pnt')) self:equals('prg', locallist('prg'), mwlist('prg')) self:equals('ps', locallist('ps'), mwlist('ps')) self:equals('pt', locallist('pt'), mwlist('pt')) self:equals('pt-br', locallist('pt-br'), mwlist('pt-br')) self:equals('qu', locallist('qu'), mwlist('qu')) self:equals('qug', locallist('qug'), mwlist('qug')) self:equals('rgn', locallist('rgn'), mwlist('rgn')) self:equals('rif', locallist('rif'), mwlist('rif')) self:equals('rm', locallist('rm'), mwlist('rm')) self:equals('rmy', locallist('rmy'), mwlist('rmy')) self:equals('rn', locallist('rn'), mwlist('rn')) self:equals('ro', locallist('ro'), mwlist('ro')) self:equals('roa-rup', locallist('roa-rup'), mwlist('roa-rup')) self:equals('roa-tara', locallist('roa-tara'), mwlist('roa-tara')) self:equals('ru', locallist('ru'), mwlist('ru')) self:equals('rue', locallist('rue'), mwlist('rue')) self:equals('rup', locallist('rup'), mwlist('rup')) self:equals('ruq', locallist('ruq'), mwlist('ruq')) self:equals('ruq-cyrl', locallist('ruq-cyrl'), mwlist('ruq-cyrl')) self:equals('ruq-grek', locallist('ruq-grek'), mwlist('ruq-grek')) self:equals('ruq-latn', locallist('ruq-latn'), mwlist('ruq-latn')) self:equals('rw', locallist('rw'), mwlist('rw')) self:equals('sa', locallist('sa'), mwlist('sa')) self:equals('sah', locallist('sah'), mwlist('sah')) self:equals('sat', locallist('sat'), mwlist('sat')) self:equals('sc', locallist('sc'), mwlist('sc')) self:equals('scn', locallist('scn'), mwlist('scn')) self:equals('sco', locallist('sco'), mwlist('sco')) self:equals('sd', locallist('sd'), mwlist('sd')) self:equals('sdc', locallist('sdc'), mwlist('sdc')) self:equals('se', locallist('se'), mwlist('se')) self:equals('sei', locallist('sei'), mwlist('sei')) self:equals('sg', locallist('sg'), mwlist('sg')) self:equals('sgs', locallist('sgs'), mwlist('sgs')) self:equals('sh', locallist('sh'), mwlist('sh')) self:equals('shi', locallist('shi'), mwlist('shi')) self:equals('shi-tfng', locallist('shi-tfng'), mwlist('shi-tfng')) self:equals('shi-latn', locallist('shi-latn'), mwlist('shi-latn')) self:equals('si', locallist('si'), mwlist('si')) self:equals('simple', locallist('simple'), mwlist('simple')) self:equals('sk', locallist('sk'), mwlist('sk')) self:equals('sl', locallist('sl'), mwlist('sl')) self:equals('sli', locallist('sli'), mwlist('sli')) self:equals('sm', locallist('sm'), mwlist('sm')) self:equals('sma', locallist('sma'), mwlist('sma')) self:equals('sn', locallist('sn'), mwlist('sn')) self:equals('so', locallist('so'), mwlist('so')) self:equals('sq', locallist('sq'), mwlist('sq')) self:equals('sr', locallist('sr'), mwlist('sr')) self:equals('sr-cyrl', locallist('sr-cyrl'), mwlist('sr-cyrl')) self:equals('sr-ec', locallist('sr-ec'), mwlist('sr-ec')) self:equals('sr-el', locallist('sr-el'), mwlist('sr-el')) self:equals('sr-latn', locallist('sr-latn'), mwlist('sr-latn')) self:equals('srn', locallist('srn'), mwlist('srn')) self:equals('ss', locallist('ss'), mwlist('ss')) self:equals('st', locallist('st'), mwlist('st')) self:equals('stq', locallist('stq'), mwlist('stq')) self:equals('su', locallist('su'), mwlist('su')) self:equals('sv', locallist('sv'), mwlist('sv')) self:equals('sw', locallist('sw'), mwlist('sw')) self:equals('szl', locallist('szl'), mwlist('szl')) self:equals('ta', locallist('ta'), mwlist('ta')) self:equals('tcy', locallist('tcy'), mwlist('tcy')) self:equals('te', locallist('te'), mwlist('te')) self:equals('tet', locallist('tet'), mwlist('tet')) self:equals('tg', locallist('tg'), mwlist('tg')) self:equals('tg-cyrl', locallist('tg-cyrl'), mwlist('tg-cyrl')) self:equals('tg-latn', locallist('tg-latn'), mwlist('tg-latn')) self:equals('th', locallist('th'), mwlist('th')) self:equals('ti', locallist('ti'), mwlist('ti')) self:equals('tk', locallist('tk'), mwlist('tk')) self:equals('tl', locallist('tl'), mwlist('tl')) self:equals('tly', locallist('tly'), mwlist('tly')) self:equals('tn', locallist('tn'), mwlist('tn')) self:equals('to', locallist('to'), mwlist('to')) self:equals('tokipona', locallist('tokipona'), mwlist('tokipona')) self:equals('tpi', locallist('tpi'), mwlist('tpi')) self:equals('tr', locallist('tr'), mwlist('tr')) self:equals('tru', locallist('tru'), mwlist('tru')) self:equals('ts', locallist('ts'), mwlist('ts')) self:equals('tt', locallist('tt'), mwlist('tt')) self:equals('tt-cyrl', locallist('tt-cyrl'), mwlist('tt-cyrl')) self:equals('tt-latn', locallist('tt-latn'), mwlist('tt-latn')) self:equals('tum', locallist('tum'), mwlist('tum')) self:equals('tw', locallist('tw'), mwlist('tw')) self:equals('ty', locallist('ty'), mwlist('ty')) self:equals('tyv', locallist('tyv'), mwlist('tyv')) self:equals('udm', locallist('udm'), mwlist('udm')) self:equals('ug', locallist('ug'), mwlist('ug')) self:equals('ug-arab', locallist('ug-arab'), mwlist('ug-arab')) self:equals('ug-latn', locallist('ug-latn'), mwlist('ug-latn')) self:equals('uk', locallist('uk'), mwlist('uk')) self:equals('ur', locallist('ur'), mwlist('ur')) self:equals('uz', locallist('uz'), mwlist('uz')) self:equals('ve', locallist('ve'), mwlist('ve')) self:equals('vec', locallist('vec'), mwlist('vec')) self:equals('vep', locallist('vep'), mwlist('vep')) self:equals('vi', locallist('vi'), mwlist('vi')) self:equals('vls', locallist('vls'), mwlist('vls')) self:equals('vmf', locallist('vmf'), mwlist('vmf')) self:equals('vo', locallist('vo'), mwlist('vo')) self:equals('vot', locallist('vot'), mwlist('vot')) self:equals('vro', locallist('vro'), mwlist('vro')) self:equals('wa', locallist('wa'), mwlist('wa')) self:equals('war', locallist('war'), mwlist('war')) self:equals('wo', locallist('wo'), mwlist('wo')) self:equals('wuu', locallist('wuu'), mwlist('wuu')) self:equals('xal', locallist('xal'), mwlist('xal')) self:equals('xh', locallist('xh'), mwlist('xh')) self:equals('xmf', locallist('xmf'), mwlist('xmf')) self:equals('yi', locallist('yi'), mwlist('yi')) self:equals('yo', locallist('yo'), mwlist('yo')) self:equals('yue', locallist('yue'), mwlist('yue')) self:equals('za', locallist('za'), mwlist('za')) self:equals('zea', locallist('zea'), mwlist('zea')) self:equals('zh', locallist('zh'), mwlist('zh')) self:equals('zh-classical', locallist('zh-classical'), mwlist('zh-classical')) self:equals('zh-cn', locallist('zh-cn'), mwlist('zh-cn')) self:equals('zh-hans', locallist('zh-hans'), mwlist('zh-hans')) self:equals('zh-hant', locallist('zh-hant'), mwlist('zh-hant')) self:equals('zh-hk', locallist('zh-hk'), mwlist('zh-hk')) self:equals('zh-min-nan', locallist('zh-min-nan'), mwlist('zh-min-nan')) self:equals('zh-mo', locallist('zh-mo'), mwlist('zh-mo')) self:equals('zh-my', locallist('zh-my'), mwlist('zh-my')) self:equals('zh-sg', locallist('zh-sg'), mwlist('zh-sg')) self:equals('zh-tw', locallist('zh-tw'), mwlist('zh-tw')) self:equals('zh-yue', locallist('zh-yue'), mwlist('zh-yue')) self:equals('zu', locallist('zu'), mwlist('zu')) end

function p:test_langSwitch_without_default self:preprocess_equals_many('', {{'en', 'English'}, {'fr', 'English'}, {'co', 'Corsu'}}) self:preprocess_equals_many('', {{'en', 'English'}, {'de', 'German'},  {'gsw', 'German'}, {'als', 'German'}}) self:preprocess_equals_many ('', {{'en', 'English'}, {'de', 'English'},  {'gsw', 'Alemanic'}, {'als', 'Alemanic'}}) self:preprocess_equals('', ' LangSwitch Error: no default ') end

function p:test_langSwitch_with_default self:preprocess_equals_many('', {{'en', 'default'}, {'fr', 'French'}, {'co', 'French'}}) self:preprocess_equals_many('', {{'en', 'English'}, {'fr', 'default'}, {'co', 'Corsu'}}) self:preprocess_equals_many(, {{'en', }, {'fr', 'French'}, {'co', 'French'}}) self:preprocess_equals_many(, {{'en', 'English'}, {'fr', }, {'co', 'Corsu'}}) self:preprocess_equals_many('', {{'en', 'English'}, {'fr', 'default'}, {'co', 'Corsu'}}) end

function p:test_translatelua self:preprocess_equals('', 'oil on canvas') self:preprocess_equals('', "huile sur toile") self:preprocess_equals('', "huile sur toile") self:preprocess_equals('', 'olej na płótnie') self:preprocess_equals('', 'Camera location') end

function p:test_autotranslate self:preprocess_equals('', 'Template:Autotranslate/test/en (lang=en) was called') self:preprocess_equals('', 'Template:Autotranslate/test/en (lang=fr) was called') self:preprocess_equals('', 'Template:Autotranslate/test/pl (lang=pl) was called') self:preprocess_equals('', 'Template:Autotranslate/test/pl (lang=szl) was called') self:preprocess_equals('', 'Template:Autotranslate/test/pl (lang=szl) was called') self:preprocess_equals('', 'Template:Autotranslate/test/es (lang=an) was called') self:preprocess_equals('', 'Template:Autotranslate/test/es (1=arg #1, lang=an, text=hello) was called') end

return p