Skip to content

Commit aeb3fd8

Browse files
committed
Fixed issue with tests.lua on Linux
### This Pull Request fixed the following issue: 1. Windows mode not properly switching (Fixed by introducing a new argument) 2. ``.`` and ``..`` mistakenly being treated as actual files (Fixed by adding a check to only allow .lua file)
1 parent 949b4ea commit aeb3fd8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ local code = [=[
1919
2020
]=];
2121

22+
for _, currArg in pairs(arg) do
23+
if currArg == "--Linux" then
24+
isWindows = false
25+
end
26+
end
27+
2228
-- Enable/Disable Console Colors - this may be needed because cmd.exe and powershell.exe do not support ANSI Color Escape Sequences. The Windows Terminal Application is needed
2329
Prometheus.colors.enabled = not noColors;
2430

@@ -39,8 +45,10 @@ local function scandir(directory)
3945
local i, t, popen = 0, {}, io.popen
4046
local pfile = popen(isWindows and 'dir "'..directory..'" /b' or 'ls -a "'..directory..'"')
4147
for filename in pfile:lines() do
42-
i = i + 1
43-
t[i] = filename
48+
if string.sub(filename, -4) == ".lua" then
49+
i = i + 1
50+
t[i] = filename
51+
end
4452
end
4553
pfile:close()
4654
return t

0 commit comments

Comments
 (0)