mirror of
https://github.com/TangentFoxy/lua-date.git
synced 2025-07-28 11:02:17 +00:00
initial test setup using busted
This commit is contained in:
@@ -14,5 +14,6 @@ Lua Date and Time module for Lua 5.x.
|
|||||||
|
|
||||||
##Changes:
|
##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.1 Lua 5.2 support. Global 'date' will no longer be set.
|
||||||
- v2.0 original by Jas Latrix
|
- v2.0 original by Jas Latrix
|
24
spec/date_spec.lua
Normal file
24
spec/date_spec.lua
Normal 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)
|
Reference in New Issue
Block a user