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:Object weight/testcases

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

function p:test_weight()
	self:preprocess_equals_preprocess_many('{{#invoke:object weight/sandbox|weight|', '}}', '{{#invoke:object weight|weight|', '}}',
		{
			{'123 grams'},
			{'123 gram'},
			{'123 gs'},
			{'123 g.'},
			{'123 g,'},
			{'123 ounces'},
			{'123 ounce'},
			{'123 oz,'},
			{'123 oz.'},
			{'123 grams (body only)'},
			{'123 gram (body only)'},
			{'123 gs (body only)'},
			{'123 g. (body only)'},
			{'123 g, (body only)'},
			{'123 ounces (body only)'},
			{'123 ounce (body only)'},
			{'123 oz, (body only)'},
			{'123 oz. (body only)'},
			{'123 ounce <ref>{{cite web|url=www.google.com}}</ref>'}
		}, {nowiki = 1})
end

function p:test_weight_should_not_convert()
	self:preprocess_equals_preprocess_many('{{#invoke:object weight/sandbox|weight|', '}}', '{{#invoke:object weight|weight|', '}}',
		{
			{'123 LBS'},
			{'123 Pounds'}
		}, {nowiki = 1})
end
return p