diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2019-09-02 14:10:26 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-09-03 14:59:43 -0300 |
commit | 0a5c5eee15072b712d0cee4cce8d642d1177ff76 (patch) | |
tree | d5af50a42837542a9a53314944b8f920be99f995 /spec | |
parent | 62a7c4f5fbb727b2509fc6d91fb6943111d30cbd (diff) | |
download | luarocks-0a5c5eee15072b712d0cee4cce8d642d1177ff76.tar.gz luarocks-0a5c5eee15072b712d0cee4cce8d642d1177ff76.tar.bz2 luarocks-0a5c5eee15072b712d0cee4cce8d642d1177ff76.zip |
fs: fix Lua wrapper for interactive mode
Diffstat (limited to 'spec')
-rw-r--r-- | spec/init_spec.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/init_spec.lua b/spec/init_spec.lua index 9d68187c..d8a8e899 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua | |||
@@ -35,6 +35,45 @@ describe("Luarocks init test #integration", function() | |||
35 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | 35 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) |
36 | end, finally) | 36 | end, finally) |
37 | end) | 37 | end) |
38 | |||
39 | it("lua wrapper works", function() | ||
40 | test_env.run_in_tmp(function(tmpdir) | ||
41 | local myproject = tmpdir .. "/myproject" | ||
42 | lfs.mkdir(myproject) | ||
43 | lfs.chdir(myproject) | ||
44 | |||
45 | assert(run.luarocks("init")) | ||
46 | if is_win then | ||
47 | assert.truthy(lfs.attributes(myproject .. "/lua.bat")) | ||
48 | assert.truthy(lfs.attributes(myproject .. "/luarocks.bat")) | ||
49 | local pd = assert(io.popen([[echo print(_VERSION) | lua.bat]], "r")) | ||
50 | local output = pd:read("*a") | ||
51 | pd:close() | ||
52 | assert.match("5", output, 1, true) | ||
53 | local fd = io.open("hello.lua", "w") | ||
54 | fd:write("print('hello' .. _VERSION)") | ||
55 | fd:close() | ||
56 | pd = assert(io.popen([[lua.bat hello.lua]], "r")) | ||
57 | output = pd:read("*a") | ||
58 | pd:close() | ||
59 | assert.match("hello", output, 1, true) | ||
60 | else | ||
61 | assert.truthy(lfs.attributes(myproject .. "/lua")) | ||
62 | assert.truthy(lfs.attributes(myproject .. "/luarocks")) | ||
63 | local pd = assert(io.popen([[echo "print('hello ' .. _VERSION)" | ./lua]], "r")) | ||
64 | local output = pd:read("*a") | ||
65 | pd:close() | ||
66 | assert.match("hello", output, 1, true) | ||
67 | local fd = io.open("hello.lua", "w") | ||
68 | fd:write("print('hello' .. _VERSION)") | ||
69 | fd:close() | ||
70 | pd = assert(io.popen([[./lua ./hello.lua]], "r")) | ||
71 | output = pd:read("*a") | ||
72 | pd:close() | ||
73 | assert.match("hello", output, 1, true) | ||
74 | end | ||
75 | end, finally) | ||
76 | end) | ||
38 | 77 | ||
39 | it("LuaRocks init with given arguments", function() | 78 | it("LuaRocks init with given arguments", function() |
40 | test_env.run_in_tmp(function(tmpdir) | 79 | test_env.run_in_tmp(function(tmpdir) |