File size: 1,653 Bytes
d7c5875 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | local test_env = require("spec.util.test_env")
local lfs = require("lfs")
local run = test_env.run
describe("Basic tests #integration", function()
before_each(function()
test_env.setup_specs()
end)
it("--version", function()
assert.is_true(run.luarocks_bool("--version"))
end)
it("unknown command", function()
assert.is_false(run.luarocks_bool("unknown_command"))
end)
it("arguments fail", function()
assert.is_false(run.luarocks_bool("--porcelain=invalid"))
assert.is_false(run.luarocks_bool("--invalid-flag"))
assert.is_false(run.luarocks_bool("--server"))
assert.is_false(run.luarocks_bool("--server --porcelain"))
assert.is_false(run.luarocks_bool("--invalid-flag=abc"))
assert.is_false(run.luarocks_bool("invalid=5"))
end)
it("executing from not existing directory #unix", function()
local main_path = lfs.currentdir()
assert.is_true(lfs.mkdir("idontexist"))
assert.is_true(lfs.chdir("idontexist"))
local delete_path = lfs.currentdir()
assert.is_true(os.remove(delete_path))
local output = run.luarocks("")
assert.is.falsy(output:find("the Lua package manager"))
assert.is_true(lfs.chdir(main_path))
output = run.luarocks("")
assert.is.truthy(output:find("the Lua package manager"))
end)
it("--timeout", function()
assert.is.truthy(run.luarocks("--timeout=10"))
end)
it("--timeout invalid", function()
assert.is_false(run.luarocks_bool("--timeout=abc"))
end)
it("--only-server", function()
assert.is.truthy(run.luarocks("--only-server=testing"))
end)
end)
|