initial test setup using busted

This commit is contained in:
Thijs Schreijer
2014-01-02 14:30:47 +01:00
parent 8d0f6e394e
commit c5eaf756ec
3 changed files with 25 additions and 0 deletions

View File

@@ -14,5 +14,6 @@ Lua Date and Time module for Lua 5.x.
##Changes:
- v2.1.1 fix for '>=' operator, initial setup of test suite
- v2.1 Lua 5.2 support. Global 'date' will no longer be set.
- v2.0 original by Jas Latrix

24
spec/date_spec.lua Normal file
View File

@@ -0,0 +1,24 @@
local date = require("date")
describe("Testing the 'date' module", function()
it("Tests date equality", function()
local a = date("20131230 00:57:04")
assert(a:getyear() == 2013)
assert(a:getmonth() == 12)
assert(a:getday() == 30)
assert(a:gethours() == 0)
assert(a:getminutes() == 57)
assert(a:getseconds() == 04)
local b = date("20131230 01:00:00")
local c = date("20131230 00:57:04") -- same as a
assert(a < b)
assert(a <= b)
assert(not (a > b))
assert(not (a >= b))
assert(a == c)
assert(a <= c)
assert(a >= c)
end)
end)