aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBronson Jordan <80419011+bpjordan@users.noreply.github.com>2024-01-15 21:48:26 -0600
committerGitHub <noreply@github.com>2024-01-15 19:48:26 -0800
commite0276bb32e9b33ece11fef2a5cfc8fb2108df0df (patch)
treea8b9bb0a2c16ab85f2ce74c198de3b6965424451 /tests
parent75e7c5c7eb5fbd53f8b12dc420b31ec70770b231 (diff)
feat: Add dry_run option and report if buffer was/would be changed by formatters (#273)
* feat: add dry_run option and pass return values for if buffer would be modified * fix: implement dry_run for blocking calls to lsp formatter * refactor: change `changed` variable to `did_edit` * docs: Update README * fix: address PR comments * fix: small cleanups --------- Co-authored-by: Steven Arcangeli <stevearc@stevearc.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/runner_spec.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/runner_spec.lua b/tests/runner_spec.lua
index 0c45117..8c0dadf 100644
--- a/tests/runner_spec.lua
+++ b/tests/runner_spec.lua
@@ -343,6 +343,11 @@ print("a")
assert.are.same(lines, vim.api.nvim_buf_get_lines(0, 0, -1, false))
end)
+ it("does not change output if dry_run is true", function()
+ run_formatter("hello", "foo", { dry_run = true })
+ assert.are.same({ "hello" }, vim.api.nvim_buf_get_lines(0, 0, -1, false))
+ end)
+
describe("range formatting", function()
it("applies edits that overlap the range start", function()
run_formatter(