Modulo:UnitTests: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
m fix tag HTML
m Togli TemplateStyles solo per il confronto, ma continua ad includerli nella pagina
 
(4 versioni intermedie di 2 utenti non mostrate)
Riga 17:
 
function UnitTester:preprocess_equals(text, expected, options)
local options = options or {}
local actual = frame:preprocess(text)
 
if actual == expected then
local compared_actual = actual;
if options.ignoreTemplateStyles then
local pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-)(%x+)(%-QINU[^\127]*\127)'
compared_actual = actual:gsub(pattern, '')
end
if actualcompared_actual == expected then
result_table = result_table .. '| ' .. tick
else
Riga 24 ⟶ 32:
num_failures = num_failures + 1
end
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(expected, actualcompared_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
Riga 165 ⟶ 173:
failures = "fallito"
end
return '__NOTALK__\n' .. (num_failures == 0 and "<span style=\"color:#008000\">'''Passati tutti i test.'''</span>" or "<span style=\"color:#800000\">'''" .. num_failures .. " test " .. failures .. ".'''</span>") .. "\n\n" .. frame:preprocess(result_table)
end