Software /
code /
prosody
File
spec/core_configmanager_spec.lua @ 10799:763bb2ce3f60
util.pposix,signal: Pass around various OS numbers as integers [Lua 5.3]
Passing around PIDs, UIDs etc as integers makes it more sane in Lua 5.3.
Getting 1234.0 as PID is silly. Shouldn't change any behavior as these
are all integers on the C side and the integral floats are accepted as
integers when passed back from Lua into C.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 04 May 2020 21:51:30 +0200 |
parent | 10495:8ea685ec0979 |
line wrap: on
line source
local configmanager = require "core.configmanager"; describe("core.configmanager", function() describe("#get()", function() it("should work", function() configmanager.set("example.com", "testkey", 123); assert.are.equal(123, configmanager.get("example.com", "testkey"), "Retrieving a set key"); configmanager.set("*", "testkey1", 321); assert.are.equal(321, configmanager.get("*", "testkey1"), "Retrieving a set global key"); assert.are.equal(321, configmanager.get("example.com", "testkey1"), "Retrieving a set key of undefined host, of which only a globally set one exists" ); configmanager.set("example.com", ""); -- Creates example.com host in config assert.are.equal(321, configmanager.get("example.com", "testkey1"), "Retrieving a set key, of which only a globally set one exists"); assert.are.equal(nil, configmanager.get(), "No parameters to get()"); assert.are.equal(nil, configmanager.get("undefined host"), "Getting for undefined host"); assert.are.equal(nil, configmanager.get("undefined host", "undefined key"), "Getting for undefined host & key"); end); end); describe("#set()", function() it("should work", function() assert.are.equal(false, configmanager.set("*"), "Set with no key"); assert.are.equal(true, configmanager.set("*", "set_test", "testkey"), "Setting a nil global value"); assert.are.equal(true, configmanager.set("*", "set_test", "testkey", 123), "Setting a global value"); end); end); end);