Fix config/prompt tests to use config.lua extension
The tests wrote config as `lush/config` (no extension) but handle_lushconfig() looks for `config.lua` or `config.lush`.
This commit is contained in:
@@ -48,7 +48,7 @@ end
|
|||||||
do
|
do
|
||||||
local tmpdir = tmpbase .. "_t1"
|
local tmpdir = tmpbase .. "_t1"
|
||||||
mkdir(tmpdir .. "/lush")
|
mkdir(tmpdir .. "/lush")
|
||||||
writefile(tmpdir .. "/lush/config", '_LUSH_TEST_MARKER = 42\n')
|
writefile(tmpdir .. "/lush/config.lua", '_LUSH_TEST_MARKER = 42\n')
|
||||||
|
|
||||||
local out = run_with_config(tmpdir, "print(_LUSH_TEST_MARKER)")
|
local out = run_with_config(tmpdir, "print(_LUSH_TEST_MARKER)")
|
||||||
assert(out:find("42"), "config file should set global: " .. out)
|
assert(out:find("42"), "config file should set global: " .. out)
|
||||||
@@ -79,7 +79,7 @@ end
|
|||||||
do
|
do
|
||||||
local tmpdir = tmpbase .. "_t3"
|
local tmpdir = tmpbase .. "_t3"
|
||||||
mkdir(tmpdir .. "/lush/config.d")
|
mkdir(tmpdir .. "/lush/config.d")
|
||||||
writefile(tmpdir .. "/lush/config", '_LUSH_SEQ = "M"\n')
|
writefile(tmpdir .. "/lush/config.lua", '_LUSH_SEQ = "M"\n')
|
||||||
writefile(tmpdir .. "/lush/config.d/01.lua",
|
writefile(tmpdir .. "/lush/config.d/01.lua",
|
||||||
'_LUSH_SEQ = _LUSH_SEQ .. "D"\n')
|
'_LUSH_SEQ = _LUSH_SEQ .. "D"\n')
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ end
|
|||||||
do
|
do
|
||||||
local tmpdir = tmpbase .. "_t4"
|
local tmpdir = tmpbase .. "_t4"
|
||||||
mkdir(tmpdir .. "/lush")
|
mkdir(tmpdir .. "/lush")
|
||||||
writefile(tmpdir .. "/lush/config", '_LUSH_SUPPRESSED = true\n')
|
writefile(tmpdir .. "/lush/config.lua", '_LUSH_SUPPRESSED = true\n')
|
||||||
|
|
||||||
local out = run_with_config_E(tmpdir, "print(_LUSH_SUPPRESSED)")
|
local out = run_with_config_E(tmpdir, "print(_LUSH_SUPPRESSED)")
|
||||||
assert(out:find("nil"), "-E should suppress config: " .. out)
|
assert(out:find("nil"), "-E should suppress config: " .. out)
|
||||||
@@ -139,7 +139,7 @@ end
|
|||||||
do
|
do
|
||||||
local tmpdir = tmpbase .. "_t7"
|
local tmpdir = tmpbase .. "_t7"
|
||||||
mkdir(tmpdir .. "/lush")
|
mkdir(tmpdir .. "/lush")
|
||||||
writefile(tmpdir .. "/lush/config", 'error("config boom")\n')
|
writefile(tmpdir .. "/lush/config.lua", 'error("config boom")\n')
|
||||||
|
|
||||||
local out = run_with_config(tmpdir, "print(99)")
|
local out = run_with_config(tmpdir, "print(99)")
|
||||||
assert(out:find("99"), "config error should be non-fatal: " .. out)
|
assert(out:find("99"), "config error should be non-fatal: " .. out)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ local function run_lua(input, config_content)
|
|||||||
local tmpdir = tmpbase .. "_run"
|
local tmpdir = tmpbase .. "_run"
|
||||||
mkdir(tmpdir .. "/lush")
|
mkdir(tmpdir .. "/lush")
|
||||||
if config_content then
|
if config_content then
|
||||||
writefile(tmpdir .. "/lush/config", config_content)
|
writefile(tmpdir .. "/lush/config.lua", config_content)
|
||||||
end
|
end
|
||||||
local cmd = string.format(
|
local cmd = string.format(
|
||||||
'printf "%%s\\n" %s | XDG_CONFIG_HOME="%s" ./lua -i 2>&1',
|
'printf "%%s\\n" %s | XDG_CONFIG_HOME="%s" ./lua -i 2>&1',
|
||||||
|
|||||||
Reference in New Issue
Block a user