-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from ej-shafran/nightly
Apply changes from nightly
- Loading branch information
Showing
7 changed files
with
98 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
local helpers = require("spec.test_helpers") | ||
local assert = require("luassert") | ||
|
||
local pwd | ||
if vim.o.shell:match("cmd.exe$") then | ||
pwd = "echo %cd%" | ||
elseif vim.o.shell:match("pwsh$") or vim.o.shell:match("powershell$") then | ||
pwd = "$pwd" | ||
else | ||
pwd = "pwd" | ||
end | ||
|
||
describe(":Compile", function() | ||
before_each(helpers.setup_tests) | ||
|
||
it("should use the current working directory", function() | ||
local cwd = vim.fn.getcwd() | ||
helpers.compile({ args = pwd }) | ||
assert.are.same({ pwd, cwd }, helpers.get_output()) | ||
end) | ||
|
||
it("should use vim.g.compilation_directory if set", function() | ||
local dir = vim.fn.fnamemodify(vim.fn.getcwd(), ":h") | ||
vim.g.compilation_directory = dir | ||
|
||
helpers.compile({ args = pwd }) | ||
assert.are.same({ pwd, dir }, helpers.get_output()) | ||
end) | ||
|
||
it("should unset vim.g.compilation_directory", function() | ||
vim.g.compilation_directory = vim.fn.fnamemodify(vim.fn.getcwd(), ":h") | ||
|
||
helpers.compile({ args = pwd }) | ||
assert.is_nil(vim.g.compilation_directory) | ||
end) | ||
end) | ||
|
||
describe(":Recompile", function() | ||
before_each(helpers.setup_tests) | ||
|
||
it("should reuse the directory from last compilation", function() | ||
local old_cwd = vim.fn.getcwd() | ||
helpers.compile({ args = pwd }) | ||
assert.are.same({ pwd, old_cwd }, helpers.get_output()) | ||
|
||
-- Over the current working directory | ||
helpers.change_vim_directory("..") | ||
helpers.recompile({ args = pwd }) | ||
assert.are.same({ pwd, old_cwd }, helpers.get_output()) | ||
helpers.change_vim_directory(old_cwd) | ||
|
||
-- Over vim.g.compilation_directory | ||
vim.g.compilation_directory = vim.fn.fnamemodify(vim.fn.getcwd(), ":h") | ||
helpers.recompile({ args = pwd }) | ||
assert.are.same({ pwd, old_cwd }, helpers.get_output()) | ||
vim.g.compilation_directory = nil | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters