Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Person weight/testcases

From Wikipedia, the free encyclopedia
-- Unit tests for [[Module:Person weight]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_weight_kg()
	self:preprocess_equals_preprocess_many('{{#invoke:person weight/sandbox|weight|', '}}', '{{#invoke:person weight|weight|', '}}',
		{
			{'91 kilogram'},
			{'128 kilograms'},
			{'128 [[kg]]'},
			{'128 [[kg]]s'},
			{'128 [[kilograms]]'},
			{'128 [[kilogram]]'},
			{'128 [[kilogram]]s'},
			{'253 kg'},
			{'543 kgs'},
			{'232 kg.'},
			{'232 kg,'},
			{'1254 kg'},
			{'1,254 kgs'},
			{'  1,145 kgs'},
			{'12,254 kgs'},
		}, {nowiki = 1})
end

function p:test_weight_lbs()
	self:preprocess_equals_preprocess_many('{{#invoke:person weight/sandbox|weight|', '}}', '{{#invoke:person weight|weight|', '}}',
		{
			{'91 pound'},
			{'128 pounds'},
			{'128 [[Pound (mass)|pound]]'},
			{'745 [[Pound (mass)|pounds]]'},
			{'253 lbs'},
			{'543 lb'},
			{'232 lb.'},
			{'232 lb,'},
			{'1254 lbs'},
			{'1,254 lbs'},
			{'12,254 lbs'}
		}, {nowiki = 1})
end

function p:test_weight_st()
	self:preprocess_equals_preprocess_many('{{#invoke:person weight/sandbox|weight|', '}}', '{{#invoke:person weight|weight|', '}}',
		{
			{'91 st'},
			{'128 stone'},
			{'253 st.'},
			{'543 st,'},
			{'1254 st'},
			{'1,254 st'},
			{'15,254 st'},
			{'453 [[Stone (unit)|stone]]'}
		}, {nowiki = 1})
end

function p:test_with_reference()
	self:preprocess_equals_preprocess_many('{{#invoke:person weight/sandbox|weight|', '}}', '{{#invoke:person weight|weight|', '}}',
		{
			{'91 kg<ref>{{cite web|url=https://www.google.com|title=Title}}</ref>'},
			{'85 lbs<ref>{{cite web|url=https://www.somewebsite.com|title=Title}}</ref>'},
		}, {nowiki = 1, stripmarker = 1})
end

return p