Modulo:UnitTests: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
+NOTALK |
+opzione "templatestyles" scopiazzata da en:Module:UnitTests |
||
Riga 18:
function UnitTester:preprocess_equals(text, expected, options)
local actual = frame:preprocess(text)
local compared_expected = expected
local compared_actual = actual
if options.templatestyles then
-- Sistema gli ID negli strip marker di TemplateStyles, usando quelli del risultato atteso
-- anche nel risultato effettivo.
local pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-)(%x+)(%-QINU[^\127]*\127)'
local _, expected_stripmarker_id = compared_expected:match(pattern)
if expected_stripmarker_id then
compared_actual = compared_actual:gsub(pattern, '%1' .. expected_stripmarker_id .. '%3')
compared_expected = compared_expected:gsub(pattern, '%1' .. expected_stripmarker_id .. '%3')
end
end
if compared_actual == compared_expected then
result_table = result_table .. '| ' .. tick
else
Riga 26 ⟶ 40:
local nowiki_open = (options and options.nowiki) and '<nowiki>' or ''
local nowiki_close = (options and options.nowiki) and '</nowiki>' or ''
local differs_at = self.differs_at and (' || ' .. first_difference(
result_table = result_table .. ' || <nowiki>' .. text:gsub('%|', '|') .. '</nowiki> || ' .. nowiki_open .. expected .. nowiki_close .. ' || ' .. nowiki_open .. actual .. nowiki_close .. differs_at .. "\n|-\n"
end
|