From b2a39e3c228c5180cefe6e547c62ea205a0dd310 Mon Sep 17 00:00:00 2001 From: Roman Tsisyk <roman@tsisyk.com> Date: Mon, 7 Oct 2013 16:54:06 +0400 Subject: [PATCH] Add a test case for #38 --- test/box/configuration.result | 12 ++++++++++++ test/box/configuration.test | 8 ++++++++ test/box/require_init.lua | 1 + test/box/require_mod.lua | 7 +++++++ 4 files changed, 28 insertions(+) create mode 100644 test/box/require_init.lua create mode 100644 test/box/require_mod.lua diff --git a/test/box/configuration.result b/test/box/configuration.result index 62f81900b6..eab2d38d46 100644 --- a/test/box/configuration.result +++ b/test/box/configuration.result @@ -249,3 +249,15 @@ readahead = 16320 slab_alloc_arena = 0.1 wal_dir_rescan_delay = 0.1 ... +lua string.gmatch(package.path, '([^;]*)')() +--- + - script_dir/?.lua +... +lua string.gmatch(package.cpath, '([^;]*)')() +--- + - script_dir/?.so +... +lua mod.test(10, 15) +--- + - 25 +... diff --git a/test/box/configuration.test b/test/box/configuration.test index 9ed8d7e7be..e97763f593 100644 --- a/test/box/configuration.test +++ b/test/box/configuration.test @@ -75,6 +75,14 @@ server.stop() server.deploy("box/tarantool_scriptdir.cfg") exec admin "lua print_config()" +# Test script_dir + require +server.stop() +shutil.copy("box/require_init.lua", os.path.join(script_dir_path, "init.lua")) +shutil.copy("box/require_mod.lua", os.path.join(script_dir_path, "mod.lua")) +server.deploy("box/tarantool_scriptdir.cfg") +exec admin "lua string.gmatch(package.path, '([^;]*)')()" +exec admin "lua string.gmatch(package.cpath, '([^;]*)')()" +exec admin "lua mod.test(10, 15)" # restore default server server.stop() diff --git a/test/box/require_init.lua b/test/box/require_init.lua new file mode 100644 index 0000000000..51e05ffcb3 --- /dev/null +++ b/test/box/require_init.lua @@ -0,0 +1 @@ +mod = require("mod") diff --git a/test/box/require_mod.lua b/test/box/require_mod.lua new file mode 100644 index 0000000000..d708a86089 --- /dev/null +++ b/test/box/require_mod.lua @@ -0,0 +1,7 @@ +exports = {} + +function exports.test(a, b) + return a+b +end + +return exports -- GitLab