Module:ISOdate/sandbox/testcases2
මොඩියුල උපදෙස්
local ISOdate = require('Module:ISOdate/sandbox')._ISOdate-- the module to be tested
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()
function suite:test_01_Parse_simple()
self:assertEquals( ISOdate('1969-07-20 20:17:40','en'), '20 July 1969, 20:17:40')
self:assertEquals( ISOdate('1969-07-20 20:17' ,'en'), '20 July 1969, 20:17')
self:assertEquals( ISOdate('1969-07-20' ,'en'), '20 July 1969')
self:assertEquals( ISOdate('1969-07' ,'en'), 'July 1969')
self:assertEquals( ISOdate('1969 ' ,'en'), '1969')
end
function suite:test_02_Parse_with_T()
self:assertEquals( ISOdate('1969-07-20T20:17:40' ,'en'), '20 July 1969, 20:17:40')
self:assertEquals( ISOdate('1969-07-20T20:17:40Z' ,'en'), '20 July 1969, 20:17:40')
self:assertEquals( ISOdate('+1969-07-20 20:17:40Z','en'), '20 July 1969, 20:17:40')
self:assertEquals( ISOdate('1969-07-20T20:17' ,'en'), '20 July 1969, 20:17')
self:assertEquals( ISOdate('+1969-07-20' ,'en'), '20 July 1969')
self:assertEquals( ISOdate('+1969-07' ,'en'), 'July 1969')
self:assertEquals( ISOdate('+1969 ' ,'en'), '1969')
end
function suite:test_03_Parse_followed_by_text()
self:assertEquals( ISOdate('1969-07-20 20:17:40(text)','en'), '20 July 1969, 20:17:40(text)')
self:assertEquals( ISOdate('1969-07-20 20:17 text' ,'en'), '20 July 1969, 20:17 text')
self:assertEquals( ISOdate('1969-07-20 more text' ,'en'), '20 July 1969 more text')
self:assertEquals( ISOdate('1969-07 text' ,'en'), 'July 1969 text')
self:assertEquals( ISOdate('1969 text' ,'en'), '1969 text')
end
return suite