Module:Term/testcases/keys: Difference between revisions

From Space Station 14 Wiki
Aliser (talk | contribs)
Created page with "local p = require('Module:Module:Term') -- the module to be tested local ScribuntoUnit = require('Module:ScribuntoUnit') local suite = ScribuntoUnit:new() local frame = mw.getCurrentFrame() local terms_json = mw:loadJsonData(p.terms_json_path and p.terms_json_path or error("failed to load terms json table: table path is not exported")) function suite:test_keys_casing() for key, _ in terms_json do self:assertEquals(string.lower(key), key) end end return suite"
 
Aliser (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
local p = require('Module:Module:Term') -- the module to be tested
local p = require('Module:Term') -- the module to be tested
local ScribuntoUnit = require('Module:ScribuntoUnit')
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()
local suite = ScribuntoUnit:new()
Line 5: Line 5:
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()


local terms_json = mw:loadJsonData(p.terms_json_path and p.terms_json_path or error("failed to load terms json table: table path is not exported"))
if not p.terms_json_path then
error("failed to load terms json table: table path is not exported")
end
local terms_json = mw.loadJsonData(p.terms_json_path)


function suite:test_keys_casing()
function suite:test_keys_casing()
for key, _ in terms_json do
for key, _ in pairs(terms_json) do
self:assertEquals(string.lower(key), key)
self:assertEquals(string.lower(key), key)
end
end

Latest revision as of 06:20, 25 May 2025

Documentation for this module may be created at Module:Term/testcases/keys/doc

local p = require('Module:Term') -- the module to be tested
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()

local frame = mw.getCurrentFrame()

if not p.terms_json_path then
	error("failed to load terms json table: table path is not exported")
end
local terms_json = mw.loadJsonData(p.terms_json_path)

function suite:test_keys_casing()
	for key, _ in pairs(terms_json) do
		self:assertEquals(string.lower(key), key)
	end
end

return suite