-- Unit tests for . Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test1_Valid_YMD_date_Full_month_name self:preprocess_equals('', '2000-01-17') self:preprocess_equals('', '2000-01-17') self:preprocess_equals('', '2000-02-29') self:preprocess_equals('', '1900-02-28') self:preprocess_equals('', '2000-03-17') self:preprocess_equals('', '2000-04-17') self:preprocess_equals('', '2000-05-17') self:preprocess_equals('', '2000-06-17') self:preprocess_equals('', '2000-07-17') self:preprocess_equals('', '2000-08-17') self:preprocess_equals('', '2000-09-17') self:preprocess_equals('', '2000-10-17') self:preprocess_equals('', '2000-11-17') self:preprocess_equals('', '2000-12-17') self:preprocess_equals('', '2000-12-17') self:preprocess_equals('', '2000-12-17')end
function p:test2_Valid_YMD_date_Abbreviated_month_name self:preprocess_equals('', '2000-01-01') self:preprocess_equals('', '2000-02-01') self:preprocess_equals('', '2000-03-01') self:preprocess_equals('', '2000-04-01') self:preprocess_equals('', '2000-05-01') self:preprocess_equals('', '2000-06-01') self:preprocess_equals('', '2000-07-01') self:preprocess_equals('', '2000-08-01') self:preprocess_equals('', '2000-09-01') self:preprocess_equals('', '2000-09-01') self:preprocess_equals('', '2000-09-01') self:preprocess_equals('', '2000-10-01') self:preprocess_equals('', '2000-11-01') self:preprocess_equals('', '2000-12-01') self:preprocess_equals('', '2000-12-01') self:preprocess_equals('', '2000-12-01')end
function p:test3_Invalid_month self:preprocess_equals('', '2000 Janet 17') self:preprocess_equals('', '2000 abc 11') self:preprocess_equals('', '2000 abc. 11') self:preprocess_equals('', '2000 abcdefghi 11')end
function p:test4_Invalid_day_of_month self:preprocess_equals('', '2000 January 00') self:preprocess_equals('', '2000 January 32') self:preprocess_equals('', '2000 February 30') self:preprocess_equals('', '1900 February 29')end
function p:test5_Invalid_no_input self:preprocess_equals('', ) self:preprocess_equals('', ) self:preprocess_equals('', )end
function p:test6_Invalid_pattern_Invalid_date self:preprocess_equals('', '2000 Dec 117') self:preprocess_equals('', '200 Dec 17') self:preprocess_equals('', '2000 De 17') self:preprocess_equals('', '2000 Septemberrr 17')end
function p:test7_Invalid_pattern_Non_YMD_date self:preprocess_equals('', '1 Dec 2000') self:preprocess_equals('', '17 December 2000') self:preprocess_equals('', 'Dec 1, 2000') self:preprocess_equals('', 'Dec. 1, 2000') self:preprocess_equals('', 'December 17, 2000') self:preprocess_equals('', '2000-12-17')end
return p