Spring til indhold

Modul:Citation/CS1/Date validation/testcases

Fra Wikipedia, den frie encyklopædi
Dette er siden til testcases for modulet Modul:Citation/CS1/Date validation. Vis resultatet af testen.
-- Testcases for datovalidering i CS1-kilder
-- Gå til diskussionssiden for at se testresultaterne.

local p = require('Modul:UnitTests')
 
function p:test_aar_interval()
	self:preprocess_equals_preprocess_many(
		'{{Kilde www/sandkasse | title=Min kilde | url=http://example.com | ', '}}',
		'{{Kilde www           | title=Min kilde | url=http://example.com | ', '}}',
		{
			{'date=2018-2019'},
			{'date=2018–2019'},
			{'date=2018 - 2019'},
			{'date=2018 – 2019'},
		}
	)
end

function p:test_maaned_interval()
	self:preprocess_equals_preprocess_many(
		'{{Kilde www/sandkasse | title=Min kilde | url=http://example.com | ', '}}',
		'{{Kilde www           | title=Min kilde | url=http://example.com | ', '}}',
		{
			{'date=maj-juni 2019'},
			{'date=maj–juni 2019'},
			{'date=maj - juni 2019'},
			{'date=maj – juni 2019'},
		}
	)
end

function p:test_dag_interval()
	self:preprocess_equals_preprocess_many(
		'{{Kilde www/sandkasse | title=Min kilde | url=http://example.com | ', '}}',
		'{{Kilde www           | title=Min kilde | url=http://example.com | ', '}}',
		{
			{'date=3.-5. juni 2019'},
			{'date=3.–5. juni 2019'},
			{'date=3. - 5. juni 2019'},
			{'date=3. – 5. juni 2019'},
		}
	)
end

function p:test_dag_maaned_interval()
	self:preprocess_equals_preprocess_many(
		'{{Kilde www/sandkasse | title=Min kilde | url=http://example.com | ', '}}',
		'{{Kilde www           | title=Min kilde | url=http://example.com | ', '}}',
		{
			{'date=3. maj-5. juni 2019'},
			{'date=3. maj–5. juni 2019'},
			{'date=3. maj - 5. juni 2019'},
			{'date=3. maj – 5. juni 2019'},
		}
	)
end

function p:test_dag_maaned_aar_interval()
	self:preprocess_equals_preprocess_many(
		'{{Kilde www/sandkasse | title=Min kilde | url=http://example.com | ', '}}',
		'{{Kilde www           | title=Min kilde | url=http://example.com | ', '}}',
		{
			{'date=3. maj 2018-5. juni 2019'},
			{'date=3. maj 2018–5. juni 2019'},
			{'date=3. maj 2018 - 5. juni 2019'},
			{'date=3. maj 2018 – 5. juni 2019'},
		}
	)
end

function p:test_maaned_aar_interval()
	self:preprocess_equals_preprocess_many(
		'{{Kilde www/sandkasse | title=Min kilde | url=http://example.com | ', '}}',
		'{{Kilde www           | title=Min kilde | url=http://example.com | ', '}}',
		{
			{'date=maj 2018-juni 2019'},
			{'date=maj 2018–juni 2019'},
			{'date=maj 2018 - juni 2019'},
			{'date=maj 2018 – juni 2019'},
		}
	)
end

function p:test_ISO_date()
	self:preprocess_equals_preprocess_many(
		'{{Kilde www/sandkasse | title=Min kilde | url=http://example.com | ', '}}',
		'{{Kilde www           | title=Min kilde | url=http://example.com | ', '}}',
		{
			{'date=2020-01-01'},
			{'date=2025-33-33'},
		}
	)
end

return p