From a034bb6ae0748d7adc7a04c6a8e5753c0f13eae4 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 7 Nov 2015 10:42:33 -0600 Subject: [PATCH] spec/tzcache: Add tests for tzcache --- spec/tzcache_spec.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/tzcache_spec.lua 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) -- 2.39.5