diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/init_spec.lua | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/init_spec.lua b/spec/init_spec.lua index dadeb300..be10b5b1 100644 --- a/spec/init_spec.lua +++ b/spec/init_spec.lua | |||
@@ -36,6 +36,69 @@ describe("luarocks init #integration", function() | |||
36 | end, finally) | 36 | end, finally) |
37 | end) | 37 | end) |
38 | 38 | ||
39 | it("with --no-gitignore", 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 --no-gitignore")) | ||
46 | if is_win then | ||
47 | assert.truthy(lfs.attributes(myproject .. "/lua.bat")) | ||
48 | assert.truthy(lfs.attributes(myproject .. "/luarocks.bat")) | ||
49 | else | ||
50 | assert.truthy(lfs.attributes(myproject .. "/lua")) | ||
51 | assert.truthy(lfs.attributes(myproject .. "/luarocks")) | ||
52 | end | ||
53 | assert.truthy(lfs.attributes(myproject .. "/lua_modules")) | ||
54 | assert.truthy(lfs.attributes(myproject .. "/.luarocks")) | ||
55 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) | ||
56 | assert.falsy(lfs.attributes(myproject .. "/.gitignore")) | ||
57 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | ||
58 | end, finally) | ||
59 | end) | ||
60 | |||
61 | it("with --no-wrapper-scripts", function() | ||
62 | test_env.run_in_tmp(function(tmpdir) | ||
63 | local myproject = tmpdir .. "/myproject" | ||
64 | lfs.mkdir(myproject) | ||
65 | lfs.chdir(myproject) | ||
66 | |||
67 | assert(run.luarocks("init --no-wrapper-scripts")) | ||
68 | assert.falsy(lfs.attributes(myproject .. "/lua.bat")) | ||
69 | assert.falsy(lfs.attributes(myproject .. "/luarocks.bat")) | ||
70 | assert.falsy(lfs.attributes(myproject .. "/lua")) | ||
71 | assert.falsy(lfs.attributes(myproject .. "/luarocks")) | ||
72 | assert.truthy(lfs.attributes(myproject .. "/lua_modules")) | ||
73 | assert.truthy(lfs.attributes(myproject .. "/.luarocks")) | ||
74 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) | ||
75 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) | ||
76 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | ||
77 | end, finally) | ||
78 | end) | ||
79 | |||
80 | it("with --wrapper-dir", function() | ||
81 | test_env.run_in_tmp(function(tmpdir) | ||
82 | local myproject = tmpdir .. "/myproject" | ||
83 | lfs.mkdir(myproject) | ||
84 | lfs.chdir(myproject) | ||
85 | |||
86 | assert(run.luarocks("init --wrapper-dir=./bin")) | ||
87 | if is_win then | ||
88 | assert.truthy(lfs.attributes(myproject .. "/bin/lua.bat")) | ||
89 | assert.truthy(lfs.attributes(myproject .. "/bin/luarocks.bat")) | ||
90 | else | ||
91 | assert.truthy(lfs.attributes(myproject .. "/bin/lua")) | ||
92 | assert.truthy(lfs.attributes(myproject .. "/bin/luarocks")) | ||
93 | end | ||
94 | assert.truthy(lfs.attributes(myproject .. "/lua_modules")) | ||
95 | assert.truthy(lfs.attributes(myproject .. "/.luarocks")) | ||
96 | assert.truthy(lfs.attributes(myproject .. "/.luarocks/config-" .. test_env.lua_version .. ".lua")) | ||
97 | assert.truthy(lfs.attributes(myproject .. "/.gitignore")) | ||
98 | assert.truthy(lfs.attributes(myproject .. "/myproject-dev-1.rockspec")) | ||
99 | end, finally) | ||
100 | end) | ||
101 | |||
39 | it("lua wrapper works", function() | 102 | it("lua wrapper works", function() |
40 | test_env.run_in_tmp(function(tmpdir) | 103 | test_env.run_in_tmp(function(tmpdir) |
41 | local myproject = tmpdir .. "/myproject" | 104 | local myproject = tmpdir .. "/myproject" |