Модуль:Test/ED

Материал из свободной русской энциклопедии «Традиция»
Перейти к навигации Перейти к поиску
Call Result
mw.ext.externaldata.getFileData
JSON with JSONPath
mw.ext.externaldata.getFileData {
    "use jsonpath"
  , file = "test"
  , data = "name=$.name,version=$.version"
  , format = "JSON"
}
"(error)"

"table#1 {\

 [\"72b1f104fce1a950942952f65d7bb877\"] = \"Файл test не определён.\",\

}"

Absent file
mw.ext.externaldata.getFileData {
    "use jsonpath"
  , file = "test1"
  , data = "name=$.name,version=$.version"
  , format = "JSON"
}
"(error)"

"table#1 {\

 [\"4e95f2542a622997f2ccde3730c16372\"] = \"Файл test1 не определён.\",\

}"

mw.ext.externaldata.getSoapData
Wrong URL
mw.ext.externaldata.getSoapData {
    "use xpath"
  , format = "XML"
  , request = "GetCurrentExchangeRates"
  , url = "http://www.falsemnb.hu/arfolyamok.asmx?wsdl"
  , data = table#1 {
  ["date"] = "/MNBCurrentExchangeRates/Day/@date",
  ["from"] = "/MNBCurrentExchangeRates/Day/Rate/@curr",
  ["from_nominal"] = "/MNBCurrentExchangeRates/Day/Rate/@unit",
  ["rate"] = "/MNBCurrentExchangeRates/Day/Rate",
}
  , response = "GetCurrentExchangeRatesResult"
}
"(error)"

"table#1 {\

 [\"2f27468eb8cedd5c5a75a6ad4d73ba3d\"] = \"При создании клиента SOAP выброшено исключение SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.falsemnb.hu/arfolyamok.asmx?wsdl' : failed to load external entity \\\"http://www.falsemnb.hu/arfolyamok.asmx?wsdl\\\"\\\

.\",\

 [\"93a612eea0e754bfc93d61eaaa05d641\"] = \"Не удалось получить URL http://www.falsemnb.hu/arfolyamok.asmx?wsdl после 3 попыток.\",\

}"

XML with xpath
mw.ext.externaldata.getSoapData {
    "use xpath"
  , format = "XML"
  , request = "GetCurrentExchangeRates"
  , url = "http://www.mnb.hu/arfolyamok.asmx?wsdl"
  , data = table#1 {
  ["date"] = "/MNBCurrentExchangeRates/Day/@date",
  ["from"] = "/MNBCurrentExchangeRates/Day/Rate/@curr",
  ["from_nominal"] = "/MNBCurrentExchangeRates/Day/Rate/@unit",
  ["rate"] = "/MNBCurrentExchangeRates/Day/Rate",
}
  , response = "GetCurrentExchangeRatesResult"
}
table#1 {
 table#2 {
   ["date"] = "2024-12-02",
   ["from"] = "AUD",
   ["from_nominal"] = "1",
   ["rate"] = "255,81",
 },
 table#3 {
   ["from"] = "BGN",
   ["from_nominal"] = "1",
   ["rate"] = "211,72",
 },
 table#4 {
   ["from"] = "BRL",
   ["from_nominal"] = "1",
   ["rate"] = "65,94",
 },
 table#5 {
   ["from"] = "CAD",
   ["from_nominal"] = "1",
   ["rate"] = "280,73",
 },
 table#6 {
   ["from"] = "CHF",
   ["from_nominal"] = "1",
   ["rate"] = "444,54",
 },
 table#7 {
   ["from"] = "CNY",
   ["from_nominal"] = "1",
   ["rate"] = "54,16",
 },
 table#8 {
   ["from"] = "CZK",
   ["from_nominal"] = "1",
   ["rate"] = "16,4",
 },
 table#9 {
   ["from"] = "DKK",
   ["from_nominal"] = "1",
   ["rate"] = "55,52",
 },
 table#10 {
   ["from"] = "EUR",
   ["from_nominal"] = "1",
   ["rate"] = "414,1",
 },
 table#11 {
   ["from"] = "GBP",
   ["from_nominal"] = "1",
   ["rate"] = "500,36",
 },
 table#12 {
   ["from"] = "HKD",
   ["from_nominal"] = "1",
   ["rate"] = "50,62",
 },
 table#13 {
   ["from"] = "IDR",
   ["from_nominal"] = "100",
   ["rate"] = "2,48",
 },
 table#14 {
   ["from"] = "ILS",
   ["from_nominal"] = "1",
   ["rate"] = "108,2",
 },
 table#15 {
   ["from"] = "INR",
   ["from_nominal"] = "1",
   ["rate"] = "4,65",
 },
 table#16 {
   ["from"] = "ISK",
   ["from_nominal"] = "1",
   ["rate"] = "2,85",
 },
 table#17 {
   ["from"] = "JPY",
   ["from_nominal"] = "100",
   ["rate"] = "261,96",
 },
 table#18 {
   ["from"] = "KRW",
   ["from_nominal"] = "100",
   ["rate"] = "28,05",
 },
 table#19 {
   ["from"] = "MXN",
   ["from_nominal"] = "1",
   ["rate"] = "19,28",
 },
 table#20 {
   ["from"] = "MYR",
   ["from_nominal"] = "1",
   ["rate"] = "88,31",
 },
 table#21 {
   ["from"] = "NOK",
   ["from_nominal"] = "1",
   ["rate"] = "35,54",
 },
 table#22 {
   ["from"] = "NZD",
   ["from_nominal"] = "1",
   ["rate"] = "232,57",
 },
 table#23 {
   ["from"] = "PHP",
   ["from_nominal"] = "1",
   ["rate"] = "6,71",
 },
 table#24 {
   ["from"] = "PLN",
   ["from_nominal"] = "1",
   ["rate"] = "96,48",
 },
 table#25 {
   ["from"] = "RON",
   ["from_nominal"] = "1",
   ["rate"] = "83,21",
 },
 table#26 {
   ["from"] = "RSD",
   ["from_nominal"] = "1",
   ["rate"] = "3,54",
 },
 table#27 {
   ["from"] = "RUB",
   ["from_nominal"] = "1",
   ["rate"] = "3,67",
 },
 table#28 {
   ["from"] = "SEK",
   ["from_nominal"] = "1",
   ["rate"] = "35,91",
 },
 table#29 {
   ["from"] = "SGD",
   ["from_nominal"] = "1",
   ["rate"] = "292,62",
 },
 table#30 {
   ["from"] = "THB",
   ["from_nominal"] = "1",
   ["rate"] = "11,42",
 },
 table#31 {
   ["from"] = "TRY",
   ["from_nominal"] = "1",
   ["rate"] = "11,36",
 },
 table#32 {
   ["from"] = "UAH",
   ["from_nominal"] = "1",
   ["rate"] = "9,45",
 },
 table#33 {
   ["from"] = "USD",
   ["from_nominal"] = "1",
   ["rate"] = "393,86",
 },
 table#34 {
   ["from"] = "ZAR",
   ["from_nominal"] = "1",
   ["rate"] = "21,71",
 },
 ["date"] = "2024-12-02",

}
"(no error)"

Broken WSDL
mw.ext.externaldata.getSoapData {
    "use xpath"
  , format = "XML"
  , request = "GetCurrentExchangeRates"
  , url = "http://www.mnb.de/arfolyamok.asmx?wsdl"
  , data = table#1 {
  ["date"] = "/MNBCurrentExchangeRates/Day/@date",
  ["from"] = "/MNBCurrentExchangeRates/Day/Rate/@curr",
  ["from_nominal"] = "/MNBCurrentExchangeRates/Day/Rate/@unit",
  ["rate"] = "/MNBCurrentExchangeRates/Day/Rate",
}
  , response = "GetCurrentExchangeRatesResult"
}
"(error)"

"table#1 {\

 [\"d134c8b58a803787a449a42c310f189b\"] = \"Не удалось получить URL http://www.mnb.de/arfolyamok.asmx?wsdl после 3 попыток.\",\

}"

mw.ext.externaldata.getDbData
mySQL
mw.ext.externaldata.getDbData {
    limit = 10
  , from = "family"
  , db = "rfam"
  , data = table#1 {
  ["name"] = "author",
  ["number"] = "num_full",
}
  , order by = "num_full DESC"
}
table#1 {
 table#2 {
   ["name"] = "Eddy SR, Griffiths-Jones SR, Mifsud W",
   ["number"] = "5335975",
 },
 table#3 {
   ["name"] = "Griffiths-Jones SR, Mifsud W, Gardner PP",
   ["number"] = "594154",
 },
 table#4 {
   ["name"] = "Bateman A",
   ["number"] = "493311",
 },
 table#5 {
   ["name"] = "Gardner PP",
   ["number"] = "383523",
 },
 table#6 {
   ["name"] = "Bateman A",
   ["number"] = "324644",
 },
 table#7 {
   ["name"] = "Griffiths-Jones SR",
   ["number"] = "278378",
 },
 table#8 {
   ["name"] = "Griffiths-Jones SR, Gardner PP",
   ["number"] = "204442",
 },
 table#9 {
   ["name"] = "Wilkinson A",
   ["number"] = "186514",
 },
 table#10 {
   ["name"] = "Gutell RR, Nawrocki E",
   ["number"] = "107465",
 },
 table#11 {
   ["name"] = "Gutell RR, Gardner PP, Nawrocki E",
   ["number"] = "75755",
 },

}
"(no error)"

MongoDB aggregate
mw.ext.externaldata.getDbData {
    from = "zips"
  , db = "mongo"
  , data = table#1 {
  ["pop"] = "totalPop",
  ["state"] = "_id",
}
  , aggregate = "[\
   { \"$group\": { \"_id\": \"$state\", \"totalPop\": { \"$sum\": \"$pop\" } } },\
   { \"$match\": { \"totalPop\": { \"$gte\": 5000000 } } }\
]\
"
  , order by = "totalPop DESC"
}
"(error)"

"table#1 {\

 [\"205308097fc119ba310a6fb8c2672be1\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует server.\",\
 [\"81898f4b59924b224881ff32a6247746\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует user/user file.\",\
 [\"ba091316401d88298a61c91d65dd0ce3\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует name.\",\
 [\"eee0a40cb9f564ab5fe302f76988f7fa\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует type.\",\

}"

MongoDB find
mw.ext.externaldata.getDbData {
    where = table#1 {
  ["state"] = "NY",
}
  , from = "zips"
  , db = "mongo"
  , limit = 10
  , data = table#1 {
  ["city"] = "city",
  ["id"] = "_id",
  ["loc"] = "loc",
  ["pop"] = "pop",
  ["state"] = "state",
}
  , order by = "pop DESC"
}
"(error)"

"table#1 {\

 [\"205308097fc119ba310a6fb8c2672be1\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует server.\",\
 [\"81898f4b59924b224881ff32a6247746\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует user/user file.\",\
 [\"ba091316401d88298a61c91d65dd0ce3\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует name.\",\
 [\"eee0a40cb9f564ab5fe302f76988f7fa\"] = \"В настройках вики неполная информация для БД с ID mongo. Отсутствует type.\",\

}"

mw.ext.externaldata.getLdapData
One entry
mw.ext.externaldata.getLdapData {
    data = table#1 {
  ["class"] = "objectClass",
  ["email"] = "mail",
  ["name"] = "uid",
  ["phone"] = "telephoneNumber",
}
  , domain = "example"
  , filter = "(sn=training)"
}
"(error)"

"table#1 {\

 [\"4315e62ddd2c5cc82e92f5bd74e0c80b\"] = \"Псевдодомен LDAP example не определён.\",\

}"

All entries
mw.ext.externaldata.getLdapData {
    "all"
  , data = table#1 {
  ["email"] = "mail",
  ["name"] = "cn",
  ["phone"] = "telephoneNumber",
}
  , domain = "example"
  , filter = "(objectClass=person)"
}
"(error)"

"table#1 {\

 [\"4315e62ddd2c5cc82e92f5bd74e0c80b\"] = \"Псевдодомен LDAP example не определён.\",\

}"

mw.ext.externaldata.getWebData
HTML with CSS
mw.ext.externaldata.getWebData {
    url = "https://www.apn.ru/index.php?do=authors&author=637"
  , data = "url=div.left_cell>h2>a.attr(href),title=div.left_cell>h2>a,date=div.left_cell>ul>li:nth-of-type(2)"
  , format = "HTML"
}
table#1 {

}
"(no error)"

JSON with JSONPath
mw.ext.externaldata.getWebData {
    use jsonpath = true
  , url = "https://discoursedb.org/w/extensions/ExternalData/nara.json"
  , data = table#1 {
  ["Num"] = "$.phoneNumbers[:].number",
}
  , format = "json"
}
table#1 {
 table#2 {
   ["Num"] = "0123-4567-8888",
 },
 table#3 {
   ["Num"] = "0123-4567-8910",
 },

}
"(no error)"

HTML with CSS. Data as a table
mw.ext.externaldata.getWebData {
    url = "https://expert.ru/avtory/konstantin_pakhunov/"
  , data = table#1 {
  ["title"] = "article h2>a",
  ["url"] = "article h2>a.attr(href)",
}
  , format = "HTML"
}
table#1 {

}
"(no error)"

XML
mw.ext.externaldata.getWebData {
    url = "http://producthelp.sdl.com/SDL%20Trados%20Studio/client_en/sample.xml"
  , data = "salutation=salutation,address=address,url=weblink,retrieved=__time"
  , format = "XML"
}
table#1 {
 table#2 {
   ["address"] = "Smith & Company Ltd.",
   ["retrieved"] = 1733210808,
   ["salutation"] = "Dear Daniel,",
   ["url"] = "http://www.smith-company-ltd.com",
 },
 table#3 {
   ["address"] = "Smithtown",
 },
 table#4 {
   ["address"] = "http://www.smith-company-ltd.com/logo.jpg",
 },
 ["retrieved"] = 1733210808,
 ["salutation"] = "Dear Daniel,",
 ["url"] = "http://www.smith-company-ltd.com",

}
"(no error)"

HTML with XPath
mw.ext.externaldata.getWebData {
    "use xpath"
  , url = "https://expert.ru/avtory/konstantin_pakhunov/"
  , data = "title=//article//h2/a,url=//article//h2/a/@href"
  , format = "HTML"
}
table#1 {

}
"(no error)"

CSV
mw.ext.externaldata.getWebData {
    url = "https://discoursedb.org/wiki/Special:GetData/Fruits_data"
  , data = "name=Name,color=Color,shape=Shape"
  , format = "CSV with header"
}
table#1 {
 table#2 {
   ["color"] = "Red or green",
   ["name"] = "Apple",
   ["shape"] = "Round",
 },
 table#3 {
   ["color"] = "Yellow",
   ["name"] = "Banana",
   ["shape"] = "Oblong",
 },
 table#4 {
   ["color"] = "Orange",
   ["name"] = "Orange",
   ["shape"] = "Round",
 },
 table#5 {
   ["color"] = "Yellow",
   ["name"] = "Pear",
   ["shape"] = "Pear-shaped",
 },

}
"(no error)"

CSV with header
mw.ext.externaldata.getWebData {
    url = "https://discoursedb.org/GermanyCSV.txt"
  , data = "bordered countries=Borders,population=Population,area=Area,capital=Capital"
  , format = "CSV with header"
}
table#1 {
 table#2 {
   ["area"] = "357,050 km²",
   ["bordered countries"] = "Austria,Belgium,Czech Republic,Denmark,France,Luxembourg,Netherlands,Poland,Switzerland",
   ["capital"] = "Berlin",
   ["population"] = "82,411,001",
 },
 ["area"] = "357,050 km²",
 ["bordered countries"] = "Austria,Belgium,Czech Republic,Denmark,France,Luxembourg,Netherlands,Poland,Switzerland",
 ["capital"] = "Berlin",
 ["population"] = "82,411,001",

}
"(no error)"

XML with XPath
mw.ext.externaldata.getWebData {
    "use xpath"
  , url = "http://producthelp.sdl.com/SDL%20Trados%20Studio/client_en/sample.xml"
  , data = "salutation=/letter/salutation,maxlength=/letter/title[2]/@maxlength,address=/letter/address[@translate='no'],url=/letter/weblink,retrieved=__time"
  , format = "XML"
}
table#1 {
 table#2 {
   ["address"] = "Smithtown",
   ["maxlength"] = "40",
   ["retrieved"] = "1733210808",
   ["salutation"] = "Dear Daniel,",
   ["url"] = "http://www.smith-company-ltd.com",
 },
 ["address"] = "Smithtown",
 ["maxlength"] = "40",
 ["retrieved"] = "1733210808",
 ["salutation"] = "Dear Daniel,",
 ["url"] = "http://www.smith-company-ltd.com",

}
"(no error)"

See also Traditio:test/ED.


local tests = {
	getWebData = {
		['HTML with CSS'] = {
			url		= 'https://www.apn.ru/index.php?do=authors&author=637'
		  , format	= 'HTML'
		  , data	= [==[
url=div.left_cell>h2>a.attr(href),title=div.left_cell>h2>a,date=div.left_cell>ul>li:nth-of-type(2)]==]
		}
	  ,	['HTML with CSS. Data as a table'] = {
			url		= 'https://expert.ru/avtory/konstantin_pakhunov/'
		  , format	= 'HTML'
		  , data	= {
				url		= 'article h2>a.attr(href)'
			  , title	= 'article h2>a'
			}
		}
	  , ['HTML with XPath'] = {
			url		= 'https://expert.ru/avtory/konstantin_pakhunov/'
		  , format	= 'HTML'
		  , data	= 'title=//article//h2/a,url=//article//h2/a/@href'
		  , 'use xpath'
		}
	  , XML = {
			url		= 'http://producthelp.sdl.com/SDL%20Trados%20Studio/client_en/sample.xml'
		  , format	= 'XML'
		  , data	= 'salutation=salutation,address=address,url=weblink,retrieved=__time'
		}
	  , ['XML with XPath'] = {
			url		= 'http://producthelp.sdl.com/SDL%20Trados%20Studio/client_en/sample.xml'
		  , format	= 'XML'
		  , data	= [==[
salutation=/letter/salutation,maxlength=/letter/title[2]/@maxlength,address=/letter/address[@translate='no'],url=/letter/weblink,retrieved=__time]==]
		  , 'use xpath'
		}
	  , ['JSON with JSONPath'] = {
			url		= 'https://discoursedb.org/w/extensions/ExternalData/nara.json'
		  , format	= 'json'
		  , data	= {Num = '$.phoneNumbers[:].number'}
		  , ['use jsonpath'] = true
		}
	  , CSV = {
			url		= 'https://discoursedb.org/wiki/Special:GetData/Fruits_data'
		  , format	= 'CSV with header'
		  , data	= 'name=Name,color=Color,shape=Shape'
		}
	  , ['CSV with header'] = {
			url		= 'https://discoursedb.org/GermanyCSV.txt'
		  , format	= 'CSV with header'
		  , data	= 'bordered countries=Borders,population=Population,area=Area,capital=Capital'
		}
	}	-- getWebData
  , getFileData = {
		['JSON with JSONPath'] = {
			file	= 'test'
		  , format	= 'JSON'
		  , data	= 'name=$.name,version=$.version'
		  , 'use jsonpath'
		}
	  ,	['Absent file'] = {
			file	= 'test1'
		  , format	= 'JSON'
		  , data	= 'name=$.name,version=$.version'
		  , 'use jsonpath'
		}
	}	-- getFileData
  , getSoapData = {
  		['XML with xpath'] = {
			url			= 'http://www.mnb.hu/arfolyamok.asmx?wsdl'
		  , request		= 'GetCurrentExchangeRates'
		  , requestData	= nil
		  , response	= 'GetCurrentExchangeRatesResult'
		  , format		= 'XML'
		  , 'use xpath'
		  , data		= {
		  		from_nominal	= '/MNBCurrentExchangeRates/Day/Rate/@unit'
		  	  , from			= '/MNBCurrentExchangeRates/Day/Rate/@curr'
		  	  , rate			= '/MNBCurrentExchangeRates/Day/Rate'
		  	  , date			= '/MNBCurrentExchangeRates/Day/@date'
			}
		}
	  , ['Broken WSDL'] = {
			url			= 'http://www.mnb.de/arfolyamok.asmx?wsdl'
		  , request		= 'GetCurrentExchangeRates'
		  , requestData	= nil
		  , response	= 'GetCurrentExchangeRatesResult'
		  , format		= 'XML'
		  , 'use xpath'
		  , data		= {
		  		from_nominal	= '/MNBCurrentExchangeRates/Day/Rate/@unit'
		  	  , from			= '/MNBCurrentExchangeRates/Day/Rate/@curr'
		  	  , rate			= '/MNBCurrentExchangeRates/Day/Rate'
		  	  , date			= '/MNBCurrentExchangeRates/Day/@date'
			}
		}
	  ,	['Wrong URL'] = {
			url			= 'http://www.falsemnb.hu/arfolyamok.asmx?wsdl'
		  , request		= 'GetCurrentExchangeRates'
		  , requestData	= nil
		  , response	= 'GetCurrentExchangeRatesResult'
		  , format		= 'XML'
		  , 'use xpath'
		  , data		= {
		  		from_nominal	= '/MNBCurrentExchangeRates/Day/Rate/@unit'
		  	  , from			= '/MNBCurrentExchangeRates/Day/Rate/@curr'
		  	  , rate			= '/MNBCurrentExchangeRates/Day/Rate'
		  	  , date			= '/MNBCurrentExchangeRates/Day/@date'
			}
		}
}	-- getSoapData
  , getLdapData = {
  		['One entry']	= {
  			domain	= 'example'
		  , filter	= '(sn=training)'
		  , data	= {
		  		name	= 'uid'
		  	  , class	= 'objectClass'
		  	  , phone	= 'telephoneNumber'
		  	  , email	= 'mail'
			}
		}
	  , ['All entries']	= {
  			domain	= 'example'
		  , filter	= '(objectClass=person)'
		  , data	= {
		  		name	= 'cn'
		  	  , phone	= 'telephoneNumber'
		  	  , email	= 'mail'
			}
		  , 'all'
   		}
	}	-- getLdapData
  , getDbData = {
  		mySQL = {
			db				= 'rfam'
		  , from			= 'family'
		  , limit			= 10
		  , ['order by']	= 'num_full DESC'
		  , data			= {
		  		name	= 'author'
		  	  , number	= 'num_full'
			}
		} -- mySQL
	  , ['MongoDB find'] = {
			db				= 'mongo'
		  , from			= 'zips'
		  , ['order by']	= 'pop DESC'
		  , where			= {state = 'NY'}
		  , limit			= 10
		  , data			= {
		  		id		= '_id'
		  	  , city	= 'city'
		  	  , state	= 'state'
		  	  , loc		= 'loc'
		  	  , pop		= 'pop'
			}
		} -- ['MongoDB find']
	  , ['MongoDB aggregate'] = {
			db				= 'mongo'
		  , from			= 'zips'
		  , ['order by']	= 'totalPop DESC'
		  , aggregate		= [==[
[
   { "$group": { "_id": "$state", "totalPop": { "$sum": "$pop" } } },
   { "$match": { "totalPop": { "$gte": 5000000 } } }
]
]==]
		  , data			= {
		  		state	= '_id'
		  	  , pop		= 'totalPop'
			}
		} -- ['MongoDB aggregate']
	}	-- getDbData
}	-- local tests

local lib, lib_name = mw.ext.externaldata, 'mw.ext.externaldata'
local dump = mw.dumpObject
	
local function run (tests)
	local results, errors = {}, {}
	for func, cases in pairs (tests) do
		results [func], errors [func] = {}, {}
		for case, params in pairs (cases) do
			local result, error = lib [func] (params)
			results [func] [case] = result or '(error)'
			errors [func] [case] = '<span class="error">' .. (error and dump(error) or '(no error)') .. '</span>'
		end
	end
	return results, errors
end	-- local function run (tests)

local p = {}

p.run = function ()
	return dump (run (tests))
end

function p.test (frame)
	local concat = table.concat
	local res = ''
	res = res .. '\n{| class="wikitable"\n! Call !! Result'
	local results, errors = run (tests)
	for func, cases in pairs (results) do
		res = res .. '\n|-\n! colspan="2" | <code>' .. lib_name .. '.' .. func .. '</code>'
		for case, result in pairs (cases) do
			res = res .. '\n|-\n|\n; ' .. case .. ' : <syntaxhighlight lang="lua">' .. lib_name .. '.' .. func .. ' {'
			local params = {}
			for param, value in pairs (tests [func] [case]) do
				if tonumber (param) then
					params [#params + 1] = dump (value)
				else
					params [#params + 1] = param .. ' = ' .. dump (value)
				end
			end
			res = res .. '\n    ' .. concat (params, '\n  , ') .. '\n}</syntaxhighlight>'
			res = res .. '\n| ' .. dump (result) .. '<br />\n' .. dump (errors [func] [case])
		end
	end
	res = res .. '\n|}'
	return frame:preprocess (res)
end

return p