]> git.madduck.net Git - etc/awesome.git/blob - spec/strftime_spec.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

f598db16f18e952da9d995e6aaf69219cdeceb8d
[etc/awesome.git] / spec / strftime_spec.lua
1 local luatz = require "luatz.init"
2 local time = 1234567890
3 describe("strftime", function()
4         local strftime = luatz.strftime.strftime
5         for i, spec in ipairs {
6                 "a", "A", "b", "B", "c", "C", "d", "D", "e", "F",
7                 "g", "G", "H", "I", "j", "m", "M", "n", "p", "r",
8                 "R", --[["s",]] "S", "t", "T", "u", "U", "V", "w", "W",
9                 "y", "Y", "z", "Z" , "%"
10         } do
11                 local tt = luatz.gmtime(time)
12                 local f = "%"..spec
13                 local osdf = "!%"..spec
14                 it("format specifier '"..f.."' is equivalent to os.date('"..osdf.."')", function()
15                         for i=1, 365*12 do
16                                 local t = time + 60*60*24*i
17                                 tt.day = tt.day + 1
18                                 tt:normalise ( )
19                                 assert.are.same(os.date(osdf,t), strftime(f,tt))
20                         end
21                 end)
22         end
23 end)