]> git.madduck.net Git - etc/awesome.git/commitdiff

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:

spec/tzcache: Add tests for tzcache
authordaurnimator <quae@daurnimator.com>
Sat, 7 Nov 2015 16:42:33 +0000 (10:42 -0600)
committerdaurnimator <quae@daurnimator.com>
Sat, 7 Nov 2015 16:42:33 +0000 (10:42 -0600)
spec/tzcache_spec.lua [new file with mode: 0644]

diff --git a/spec/tzcache_spec.lua b/spec/tzcache_spec.lua
new file mode 100644 (file)
index 0000000..ea0c211
--- /dev/null
@@ -0,0 +1,17 @@
+describe("Opening/reading system files", function()
+       local tzcache = require "luatz.tzcache"
+       it("should have a localtime", function()
+               tzcache.get_tz()
+       end)
+       it("should be able to open UTC", function()
+               tzcache.get_tz("UTC")
+       end)
+       it("should re-use results from cache", function()
+               -- If cached it should return the same table
+               local localtime = tzcache.get_tz()
+               assert.are.equal(localtime, tzcache.get_tz())
+               -- Once cache is cleared it should return a new table
+               tzcache.clear_tz_cache()
+               assert._not.equal(localtime, tzcache.get_tz())
+       end)
+end)