aboutsummaryrefslogtreecommitdiff
path: root/spec/init_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/init_spec.lua')
-rw-r--r--spec/init_spec.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/spec/init_spec.lua b/spec/init_spec.lua
index 4a9c9ab7..3bde313a 100644
--- a/spec/init_spec.lua
+++ b/spec/init_spec.lua
@@ -19,7 +19,7 @@ describe("luarocks init #integration", function()
19 local myproject = tmpdir .. "/myproject" 19 local myproject = tmpdir .. "/myproject"
20 lfs.mkdir(myproject) 20 lfs.mkdir(myproject)
21 lfs.chdir(myproject) 21 lfs.chdir(myproject)
22 22
23 assert(run.luarocks("init")) 23 assert(run.luarocks("init"))
24 if is_win then 24 if is_win then
25 assert.truthy(lfs.attributes(myproject .. "/lua.bat")) 25 assert.truthy(lfs.attributes(myproject .. "/lua.bat"))
@@ -41,7 +41,7 @@ describe("luarocks init #integration", function()
41 local myproject = tmpdir .. "/myproject" 41 local myproject = tmpdir .. "/myproject"
42 lfs.mkdir(myproject) 42 lfs.mkdir(myproject)
43 lfs.chdir(myproject) 43 lfs.chdir(myproject)
44 44
45 assert(run.luarocks("init")) 45 assert(run.luarocks("init"))
46 if is_win then 46 if is_win then
47 assert.truthy(lfs.attributes(myproject .. "/lua.bat")) 47 assert.truthy(lfs.attributes(myproject .. "/lua.bat"))
@@ -74,18 +74,18 @@ describe("luarocks init #integration", function()
74 end 74 end
75 end, finally) 75 end, finally)
76 end) 76 end)
77 77
78 it("with given arguments", function() 78 it("with given arguments", function()
79 test_env.run_in_tmp(function(tmpdir) 79 test_env.run_in_tmp(function(tmpdir)
80 local myproject = tmpdir .. "/myproject" 80 local myproject = tmpdir .. "/myproject"
81 lfs.mkdir(myproject) 81 lfs.mkdir(myproject)
82 lfs.chdir(myproject) 82 lfs.chdir(myproject)
83 83
84 assert(run.luarocks("init customname 1.0")) 84 assert(run.luarocks("init customname 1.0"))
85 assert.truthy(lfs.attributes(myproject .. "/customname-1.0-1.rockspec")) 85 assert.truthy(lfs.attributes(myproject .. "/customname-1.0-1.rockspec"))
86 end, finally) 86 end, finally)
87 end) 87 end)
88 88
89 it("with --lua-versions", function() 89 it("with --lua-versions", function()
90 test_env.run_in_tmp(function(tmpdir) 90 test_env.run_in_tmp(function(tmpdir)
91 local myproject = tmpdir .. "/myproject" 91 local myproject = tmpdir .. "/myproject"
@@ -107,14 +107,14 @@ describe("luarocks init #integration", function()
107 local myproject = tmpdir .. "/myproject" 107 local myproject = tmpdir .. "/myproject"
108 copy_dir(testing_paths.fixtures_dir .. "/git_repo", myproject) 108 copy_dir(testing_paths.fixtures_dir .. "/git_repo", myproject)
109 lfs.chdir(myproject) 109 lfs.chdir(myproject)
110 110
111 assert(run.luarocks("init")) 111 assert(run.luarocks("init"))
112 local fd = assert(io.open(myproject .. "/myproject-dev-1.rockspec", "r")) 112 local fd = assert(io.open(myproject .. "/myproject-dev-1.rockspec", "r"))
113 local content = assert(fd:read("*a")) 113 local content = assert(fd:read("*a"))
114 assert.truthy(content:find("summary = \"Test repo\"")) 114 assert.truthy(content:find("summary = \"Test repo\""))
115 assert.truthy(content:find("detailed = .+Test repo.+")) 115 assert.truthy(content:find("detailed = .+Test repo.+"))
116 assert.truthy(content:find("license = \"MIT\"")) 116 assert.truthy(content:find("license = \"MIT\""))
117 117
118 fd = assert(io.open(myproject .. "/.gitignore", "r")) 118 fd = assert(io.open(myproject .. "/.gitignore", "r"))
119 content = assert(fd:read("*a")) 119 content = assert(fd:read("*a"))
120 assert.truthy(content:find("/foo")) 120 assert.truthy(content:find("/foo"))
@@ -155,17 +155,17 @@ describe("luarocks init #integration", function()
155 155
156 os.remove(rockspec_filename) 156 os.remove(rockspec_filename)
157 os.remove("my_dependency-1.0-1.rockspec") 157 os.remove("my_dependency-1.0-1.rockspec")
158 158
159 -- re-run init 159 -- re-run init
160 assert(run.luarocks("init")) 160 assert(run.luarocks("init"))
161 161
162 -- file is recreated 162 -- file is recreated
163 assert.truthy(lfs.attributes(rockspec_filename)) 163 assert.truthy(lfs.attributes(rockspec_filename))
164 164
165 local fd = assert(io.open(rockspec_filename, "rb")) 165 local fd = assert(io.open(rockspec_filename, "rb"))
166 local rockspec = assert(fd:read("*a")) 166 local rockspec = assert(fd:read("*a"))
167 fd:close() 167 fd:close()
168 168
169 assert.no.match("my_dependency", rockspec, 1, true) 169 assert.no.match("my_dependency", rockspec, 1, true)
170 assert.no.match("config", rockspec, 1, true) 170 assert.no.match("config", rockspec, 1, true)
171 171