-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtests.lua
More file actions
30 lines (27 loc) · 842 Bytes
/
tests.lua
File metadata and controls
30 lines (27 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
do
local package = require "package"
package.path = package.path .. ";../?.lua;../?/init.lua"
end
local r = require"require"
local ok, jit = pcall(require, "jit")
if ok then
print( ("tested: [%s] %s %s/%s"):format( _VERSION or "", jit.version or "", jit.os or "", jit.arch or "") )
else
print( ("tested: [%s]"):format(_VERSION) )
end
for _i0, try in ipairs{ {"_G", _G.require}, {"require.lua:require51", r.require51}, {"require.lua:require52", r.require52}} do
local k, require = try[1], try[2]
print("")
print("with require from "..k)
if not require then
print("ERROR")
else
for _i,dir in ipairs{"mod", "modi", "modnil"} do
for _i2, name in ipairs{"true", "false", "nil"} do
local modname = dir.."."..name
local ok, res = pcall(require, modname)
print(modname, ok and type(res) or "ERROR", res)
end
end
end
end