Module:Deprecated archive/testcases
Appearance
| This is the test cases page for the module Module:Deprecated archive. Results of the test cases. |
local p = require('Module:UnitTests')
local module = require('Module:Deprecated archive')
local marker = '<sup>[[[WP:ATODAY|link removed]]]</sup>'
local function expected_label(label)
return '<span style="text-decoration: underline dashed #ccc;">' ..
label ..
'</span>' .. marker
end
local function without_tracking_category(text)
return (text:gsub('%[%[Category:[^%]]+%]%]$', ''))
end
function p:test_html_entities_render_normally()
local nbsp = mw.ustring.char(160)
self:equals(
' decodes to a non-breaking space',
without_tracking_category(module._main({
url = 'https://blacklisted.example.com/20120721063948/http://usps.whitepages.com/service/post_office/67234?p=1&s=NY&service_name=post_office&z=10001',
title = 'Post Office Location – James A. Farley',
})),
expected_label('Post Office Location' .. nbsp .. '– James A. Farley'),
{nowiki = true}
)
self:equals(
' inside a title decodes to a non-breaking space',
without_tracking_category(module._main({
url = 'https://blacklisted.example.com/20110310083111/http://www3.interscience.wiley.com/journal/122575093/abstract',
title = 'Inkjet Printing – Process and Its Applications',
})),
expected_label('Inkjet Printing' .. nbsp .. '– Process and Its Applications'),
{nowiki = true}
)
self:equals(
'– decodes to an en dash',
without_tracking_category(module._main({
url = 'https://blacklisted.example.com/20150420042022/http://factfinder.census.gov/bkmk/table/1.0/en/DEC/10_SF1/GCTPH1.CY10/0500000US34037',
title = 'GCT-PH1: Population, Housing Units, Area, and Density: 2010 - County – County Subdivision and Place from the 2010 Census Summary File 1 for Burlington County, New Jersey',
})),
expected_label('GCT-PH1: Population, Housing Units, Area, and Density: 2010 - County – County Subdivision and Place from the 2010 Census Summary File 1 for Burlington County, New Jersey'),
{nowiki = true}
)
end
return p