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

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

   lazy_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)