diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2019-09-02 14:32:54 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2019-09-03 14:56:49 -0300 |
| commit | 96b6b9ca9cf77922863d440247850b6b7c4bb9ae (patch) | |
| tree | f090af9c1d03c21bf3ba8f6d556b17f7630e3a57 /spec/install_spec.lua | |
| parent | 989c58dff675532cf6378ade3790fd7e28e5bc07 (diff) | |
| download | luarocks-96b6b9ca9cf77922863d440247850b6b7c4bb9ae.tar.gz luarocks-96b6b9ca9cf77922863d440247850b6b7c4bb9ae.tar.bz2 luarocks-96b6b9ca9cf77922863d440247850b6b7c4bb9ae.zip | |
build: fix --branch flag
The `--branch` flag is optional and takes a string argument.
The `--branch` flag does not make sense for `luarocks make` because
it does not fetch sources, it builds/installs based on whatever is
in the current directory.
This also adds tests that verify the behavior, but these don't
run in Travis CI because of issues running a Git daemon there.
They were verified locally.
Diffstat (limited to 'spec/install_spec.lua')
| -rw-r--r-- | spec/install_spec.lua | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 77ac6225..3b0b22fb 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua | |||
| @@ -3,8 +3,8 @@ local lfs = require("lfs") | |||
| 3 | local run = test_env.run | 3 | local run = test_env.run |
| 4 | local testing_paths = test_env.testing_paths | 4 | local testing_paths = test_env.testing_paths |
| 5 | local env_variables = test_env.env_variables | 5 | local env_variables = test_env.env_variables |
| 6 | local get_tmp_path = test_env.get_tmp_path | ||
| 7 | local write_file = test_env.write_file | 6 | local write_file = test_env.write_file |
| 7 | local git_repo = require("spec.util.git_repo") | ||
| 8 | 8 | ||
| 9 | test_env.unload_luarocks() | 9 | test_env.unload_luarocks() |
| 10 | 10 | ||
| @@ -234,4 +234,31 @@ describe("luarocks install #integration", function() | |||
| 234 | end) | 234 | end) |
| 235 | end) | 235 | end) |
| 236 | 236 | ||
| 237 | describe("#unix install runs build from #git", function() | ||
| 238 | local git | ||
| 239 | |||
| 240 | setup(function() | ||
| 241 | git = git_repo.start() | ||
| 242 | end) | ||
| 243 | |||
| 244 | teardown(function() | ||
| 245 | if git then | ||
| 246 | git:stop() | ||
| 247 | end | ||
| 248 | end) | ||
| 249 | |||
| 250 | it("using --branch", function() | ||
| 251 | write_file("my_branch-1.0-1.rockspec", [[ | ||
| 252 | rockspec_format = "3.0" | ||
| 253 | package = "my_branch" | ||
| 254 | version = "1.0-1" | ||
| 255 | source = { | ||
| 256 | url = "git://localhost/testrock" | ||
| 257 | } | ||
| 258 | ]], finally) | ||
| 259 | assert.is_false(run.luarocks_bool("install --branch unknown-branch ./my_branch-1.0-1.rockspec")) | ||
| 260 | assert.is_true(run.luarocks_bool("install --branch test-branch ./my_branch-1.0-1.rockspec")) | ||
| 261 | end) | ||
| 262 | end) | ||
| 263 | |||
| 237 | end) | 264 | end) |
