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:Age/testcases

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

function p:test_birth_date_and_age()
	self:preprocess_equals_preprocess_many(
		'{{birth date and age|', '}}',
		'{{birth date and age/sandbox|', '}}',
		{
			{'1990-12-12'},
			{'12 Dec 1990'},
			{'12 Dec. 1990'},
			{'12 December 1990'},
			{'December 20 1990'},
			{'12 December 1990|mf=yes'},
			{'12 December 1990|df=yes'},
			{'December 20 1990|mf=yes'},
			{'December 20 1990|df=yes'},
			{'12 Dec 1990|mf=yes'},
			{'12 Dec 1990|df=yes'},
			{'Dec 20 1990|mf=yes'},
			{'Dec 20 1990|df=yes'},
			{'June 2020'},
			{'June 2020|df=yes'},
			{'June 2020|mf=yes'},
			
			{'1995'},
			{'1995|df=yes'},
			{'1995|mf=yes'},
			{'1992|8'},
			{'1992|8|df=yes'},
			{'1992|8|df=yes'},
			{'1995|5|10'},
			{'1995|5|10|df=yes'},
			{'1995|5|10|df=yes'},
			
			
			{'year=1995'},
			{'year=1995|df=yes'},
			{'year=1995|mf=yes'},
			{'year=1992|month=8'},
			{'year=1992|month=8|df=yes'},
			{'year=1992|month=8|df=yes'},
			{'year=1995|month=5|day=10'},
			{'year=1995|month=5|day=10|df=yes'},
			{'year=1995|month=5|day=10|df=yes'},
			
		},
		{nowiki = 1, live_sandbox = 1}
	)
end

function p:test_death_date_and_age()
	self:preprocess_equals_preprocess_many(
		'{{death date and age|', '}}',
		'{{death date and age/sandbox|', '}}',
		{
			{'1990-12-12|1955-1-5'},
			{'12 December 1990|5 January 1955'},
			{'3 Oct 2025|5 Dec 1990'},
			{'3 Oct 2025|5 Dec 1990|df=yes'},
			{'3 Oct 2025|5 Dec 1990|mf=yes'},
			{'3 Oct 2025|December 5, 1990'},
			{'3 Oct 2025|December 5, 1990|mf=yes'},
			{'3 Oct 2025|December 5, 1990|df=yes'},
		},
		{nowiki = 1}
	)
end

return p