Skip to content

Commit 7fde3de

Browse files
committed
more tests
1 parent 930b761 commit 7fde3de

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

mod1.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
return {_NAME="mod1(file)"}

test.fallback.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ preload["foo.bar"] = function()
1111
return {_NAME="foo.bar"}
1212
end
1313

14+
preload["fallback.mod1"] = function()
15+
return {_NAME="mod1(fallback)"}
16+
end
17+
18+
preload["fallback.mod2"] = function()
19+
return {_NAME="mod2(fallback)"}
20+
end
21+
22+
23+
24+
assert( _require"mod1"._NAME == "mod1(file)" ) -- the mod1.lua file, not the preload["mod1"] one
25+
assert( _require"mod2"._NAME == "mod2(fallback)" ) -- the fallback mod2 because the mod2.lua is not exists.
1426

1527

1628
assert( require "string" == _require("string") )

0 commit comments

Comments
 (0)