aboutsummaryrefslogtreecommitdiff
path: root/spec/external_spec.lua
blob: 63363b76d35201cf81db5a16bd911c82d8d6b541 (plain)
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
local test_env = require("spec.util.test_env")
local run = test_env.run
local testing_paths = test_env.testing_paths

test_env.setup_specs()

describe("luarocks external commands #integration", function()
   setup(function()
      test_env.mock_server_init()
   end)

   teardown(function()
      test_env.mock_server_done()
   end)

   it("installs a legacy external command", function()
      local rockspec = testing_paths.fixtures_dir .. "/legacyexternalcommand-0.1-1.rockspec"
      assert.is_truthy(run.luarocks_bool("build " .. rockspec))
      assert.is.truthy(run.luarocks("show legacyexternalcommand"))
      local output = run.luarocks("legacyexternalcommand")
      assert.match("Argument missing", output)
      output = run.luarocks("legacyexternalcommand foo")
      assert.match("ARG1\tfoo", output)
      assert.match("ARG2\tnil", output)
      output = run.luarocks("legacyexternalcommand foo bar")
      assert.match("ARG1\tfoo", output)
      assert.match("ARG2\tbar", output)
      output = run.luarocks("legacyexternalcommand foo bar bla")
      assert.match("ARG1\tfoo", output)
      assert.match("ARG2\tbar", output)
   end)
end)