comparison spec/core_moduleapi_spec.lua @ 13400:786c7707f306

core.moduleapi: Silence strict luacheck warnings in tests
author Kim Alvefur <zash@zash.se>
date Sat, 09 Dec 2023 20:55:26 +0100
parents a6188f5d5bb5
children
comparison
equal deleted inserted replaced
13399:f4415f76727b 13400:786c7707f306
9 9
10 local api = require "core.moduleapi"; 10 local api = require "core.moduleapi";
11 11
12 local module = setmetatable({}, {__index = api}); 12 local module = setmetatable({}, {__index = api});
13 local opt = nil; 13 local opt = nil;
14 function module:log() end 14 function module.log(_self) end
15 function module:get_option(name) 15 function module.get_option(_self, name)
16 if name == "opt" then 16 if name == "opt" then
17 return opt; 17 return opt;
18 else 18 else
19 return nil; 19 return nil;
20 end 20 end
21 end 21 end
22 22
23 function test_option_value(value, returns) 23 local function test_option_value(value, returns)
24 opt = value; 24 opt = value;
25 assert(module:get_option_number("opt") == returns.number, "number doesn't match"); 25 assert(module:get_option_number("opt") == returns.number, "number doesn't match");
26 assert(module:get_option_string("opt") == returns.string, "string doesn't match"); 26 assert(module:get_option_string("opt") == returns.string, "string doesn't match");
27 assert(module:get_option_boolean("opt") == returns.boolean, "boolean doesn't match"); 27 assert(module:get_option_boolean("opt") == returns.boolean, "boolean doesn't match");
28 28