From: daurnimator Date: Sat, 7 Nov 2015 16:42:33 +0000 (-0600) Subject: spec/tzcache: Add tests for tzcache X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/a034bb6ae0748d7adc7a04c6a8e5753c0f13eae4 spec/tzcache: Add tests for tzcache --- diff --git a/spec/tzcache_spec.lua b/spec/tzcache_spec.lua new file mode 100644 index 0000000..ea0c211 --- /dev/null +++ b/spec/tzcache_spec.lua @@ -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)