localp=require('Módulo:UnitTests')--[[--------------------------< T E S T _ P A T T E R N S _ G E T >--------------------------------------------Crea una lista con los patrones de pruebas en la que cada entrada es a su vez otra lista con dos elementos: {"<code>", "<nombre del idioma según Módulo:Lang>"}]]localfunctiontest_patterns_get()localname_from_tag=require('Módulo:Lang')._name_from_tag-- use Module:Lang to create the 'expected results'localcomplete={}localiana_data=mw.loadData('Módulo:Lang/data/iana languages').active-- use the iana datalocaliana_data_es=mw.loadData('Módulo:Lang/data/iana languages translation').active-- use the iana datafork,vinpairs(iana_data)docomplete[k]=vendfork,vinpairs(iana_data_es)docomplete[k]=vendlocalcode_mask="^[j-p]%l%l"-- used to limit number of testslocaltpats={}-- collect test patterns hereforcodeinpairs(complete)do-- list of names not needed herelocalpattern={}-- here we assemble the test pattern for <code>ifcode:find(code_mask)then-- if code within limits (three-character codes)table.insert(pattern,code)-- add it to the patterntable.insert(pattern,name_from_tag({code}))-- call module:lang and add the 'expected results' for code to patterntable.insert(tpats,pattern)-- accumulate in list of patternsendendlocalfunctioncomp(a,b)-- local function used by table.sort()returna[1]<b[1]-- ascending sort by codeendtable.sort(tpats,comp)-- make the list prettyreturntpats-- and doneend--[[--------------------------< T E S T _ N A M E _ F R O M _ T A G >----------------------------------]]functionp:test_name_from_tag_iso_639_3_2()localtest_patterns=test_patterns_get()self:preprocess_equals_preprocess_many('{{#invoke:Lang/zona de pruebas|name_from_tag|','}}','','',test_patterns,{nowiki=1})endreturnp
Noviembre 02, 2021
módulo, lang, tests, name, from, este, módulo, tiene, página, documentación, crear, módulo, lang, tests, name, from, código, discusión, tests, comprobar, tests, subpáginas, enlaces, local, require, módulo, unittests, crea, lista, patrones, pruebas, cada, entra. Este modulo no tiene pagina de documentacion crear Modulo Lang tests ISO 639 3 2 name from tag codigo doc discusion tests comprobar tests subpaginas enlaces local p require Modulo UnitTests lt T E S T P A T T E R N S G E T gt Crea una lista con los patrones de pruebas en la que cada entrada es a su vez otra lista con dos elementos lt code gt lt nombre del idioma segun Modulo Lang gt local function test patterns get local name from tag require Modulo Lang name from tag use Module Lang to create the expected results local complete local iana data mw loadData Modulo Lang data iana languages active use the iana data local iana data es mw loadData Modulo Lang data iana languages translation active use the iana data for k v in pairs iana data do complete k v end for k v in pairs iana data es do complete k v end local code mask j p l l used to limit number of tests local tpats collect test patterns here for code in pairs complete do list of names not needed here local pattern here we assemble the test pattern for lt code gt if code find code mask then if code within limits three character codes table insert pattern code add it to the pattern table insert pattern name from tag code call module lang and add the expected results for code to pattern table insert tpats pattern accumulate in list of patterns end end local function comp a b local function used by table sort return a 1 lt b 1 ascending sort by code end table sort tpats comp make the list pretty return tpats and done end lt T E S T N A M E F R O M T A G gt function p test name from tag iso 639 3 2 local test patterns test patterns get self preprocess equals preprocess many invoke Lang zona de pruebas name from tag test patterns nowiki 1 end return p Obtenido de https es wikipedia org w index php title Modulo Lang tests ISO 639 3 2 name from tag amp oldid 133188725, wikipedia, wiki, leyendo, leer, libro, biblioteca,