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
result_table = result_table .. '| ' .. tick
else
Riga 24 ⟶ 32:
num_failures = num_failures + 1
end
local nowiki_open =
local nowiki_close =
local differs_at = self.differs_at and (' || ' .. first_difference(expected,
result_table = result_table .. ' || <nowiki>' .. text:gsub('%|', '|') .. '</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
|