Modul:Time/tests
Megjelenés
Time modul tesztek[mi ez?]
Név | Várt | Tényleges | |
---|---|---|---|
![]() |
testFormatDate | Lua error -- Modul:Time/tests:23: attempt to call field 'newFromIso8061' (a nil value) | |
![]() |
testNew | Lua error -- Modul:Time/tests:6: attempt to call field 'newFromIso8061' (a nil value) | |
![]() |
testAge | Lua error -- Modul:Time/tests:14: attempt to call field 'newFromIso8061' (a nil value) |
local Time = require('Modul:Time')
local ScribuntoUnit = require('Modul:ScribuntoUnit')
local suite = ScribuntoUnit:new()
function suite:testNew()
self:assertEquals('2013-10-23', Time.newFromIso8061('2013-10-23'):toString())
local status, value = pcall(function () return mw.wikibase.getEntity().claims['p569'][0].mainsnak.datavalue.value end)
if status then
self:assertEquals('2012-10-23', Time.newFromWikidataValue(value):toString())
end
end
function suite:testAge()
local time1 = Time.newFromIso8061('2003-11-09')
local time2 = Time.newFromIso8061('2013-12-09')
local time3 = Time.newFromIso8061('2013-10-09')
self:assertEquals(10, Time.age(time1, time2))
self:assertEquals(9, Time.age(time1, time3))
self:assertTrue(Time.age(time1) >= 10)
end
function suite:testFormatDate()
self:assertEquals('[[i. e. 323]]. [[június 10.|június 10.]]', Time.newFromIso8061('-00000000322-06-05T00:00:00Z'):formatDate())
self:assertEquals('2013. október 23.', Time.newFromIso8061('2013-10-23'):formatDate{link = 'nem'})
self:assertEquals('1655', Time.newFromIso8061('1655'):formatDate{link = 'nem'})
end
return suite