-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathdownload_spec.lua
51 lines (37 loc) · 1.75 KB
/
download_spec.lua
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
local Path = require("plenary.path")
local eq = assert.are.same
local Download = require("elixir.elixirls.download")
vim.notify = function(thing)
io.stdout:write(thing .. "\n")
end
describe("download", function()
before_each(function()
vim.fn.system([[rm -rf tmp/downloads]])
assert(not Path:new("tmp/downloads"):exists(), "tmp/downloads was not deleted")
end)
it("can git clone HEAD of the source code", function()
local download_dir = "tmp/downloads"
local result = Download.clone(download_dir, { repo = "elixir-lsp/elixir-ls", ref = "HEAD" })
eq("elixir-lsp/elixir-ls/HEAD", result)
assert.True(Path:new(download_dir, "elixir-lsp/elixir-ls/HEAD", "mix.exs"):exists())
end)
it("can clone from a different repository", function()
local download_dir = "tmp/downloads"
local result = Download.clone(download_dir, { repo = "mhanberg/elixir-ls", ref = "HEAD" })
eq("mhanberg/elixir-ls/HEAD", result)
assert.True(Path:new(download_dir, "mhanberg/elixir-ls/HEAD", "mix.exs"):exists())
end)
it("can checkout a different branch", function()
local download_dir = "tmp/downloads"
local result =
Download.clone(download_dir, { repo = "mhanberg/elixir-ls", ref = "mh/all-workspace-symbols" })
eq("mhanberg/elixir-ls/mh_all-workspace-symbols", result)
assert.True(Path:new(download_dir, "mhanberg/elixir-ls/mh_all-workspace-symbols", "mix.exs"):exists())
end)
it("can checkout a different tag", function()
local download_dir = "tmp/downloads"
local result = Download.clone(download_dir, { repo = "elixir-lsp/elixir-ls", ref = "tags/v0.14.6" })
eq("elixir-lsp/elixir-ls/tags_v0.14.6", result)
assert.True(Path:new(download_dir, "elixir-lsp/elixir-ls/tags_v0.14.6", "mix.exs"):exists())
end)
end)