Modulo:UnitTests: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m definisco sempre options
m Togli TemplateStyles solo per il confronto, ma continua ad includerli nella pagina
 
(Una versione intermedia di uno stesso utente non è mostrata)
Riga 19:
local options = options or {}
local actual = frame:preprocess(text)
 
local compared_actual = actual;
if options.ignoreTemplateStyles then
local pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-)(%x+)(%-QINU[^\127]*\127)'
if compared_actual == compared_expectedactual:gsub(pattern, then'')
end
localif compared_expectedcompared_actual == expected then
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 41 ⟶ 34:
local nowiki_open = options.nowiki and '<nowiki>' or ''
local nowiki_close = options.nowiki and '</nowiki>' or ''
local differs_at = self.differs_at and (' || ' .. first_difference(compared_expectedexpected, compared_actual)) or ''
result_table = result_table .. ' || <nowiki>' .. text:gsub('%|', '&#124;') .. '</nowiki> || ' .. nowiki_open .. expected .. nowiki_close .. ' || ' .. nowiki_open .. actual .. nowiki_close .. differs_at .. "\n|-\n"
end