aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/indent/common.lua22
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/indent/common.lua b/tests/indent/common.lua
index 6add58c7f..a65aa8022 100644
--- a/tests/indent/common.lua
+++ b/tests/indent/common.lua
@@ -3,11 +3,10 @@ local M = {}
local assert = require('luassert')
local say = require('say')
local scan_dir = require('plenary.scandir').scan_dir
-local Path = require('plenary.path')
M.XFAIL = 'xfail'
-local function same_indent(state, arguments)
+local function same_indent(_, arguments)
local before = arguments[1]
local after = arguments[2]
@@ -166,7 +165,7 @@ Runner.__index = Runner
function Runner:new(it, base_dir, buf_opts)
local runner = {}
runner.it = it
- runner.base_dir = Path:new(base_dir)
+ runner.base_dir = base_dir
runner.buf_opts = buf_opts
return setmetatable(runner, self)
end
@@ -175,19 +174,18 @@ function Runner:whole_file(dirs, opts)
opts = opts or {}
local expected_failures = opts.expected_failures or {}
expected_failures = vim.tbl_map(function(f)
- return Path:new(f):make_relative(self.base_dir.filename)
+ return vim.fs.normalize(vim.fs.joinpath(self.base_dir, f))
end, expected_failures)
dirs = type(dirs) == 'table' and dirs or { dirs }
dirs = vim.tbl_map(function(dir)
- dir = self.base_dir / Path:new(dir)
- assert.is.same(1, vim.fn.isdirectory(dir.filename))
- return dir.filename
+ dir = vim.fs.normalize(vim.fs.joinpath(self.base_dir, dir))
+ assert.is.same(1, vim.fn.isdirectory(dir))
+ return dir
end, dirs)
local files = vim.iter(vim.tbl_map(scan_dir, dirs)):flatten():totable()
for _, file in ipairs(files) do
- local relpath = Path:new(file):make_relative(self.base_dir.filename)
- self.it(relpath, function()
- M.indent_whole_file(file, self.buf_opts, vim.tbl_contains(expected_failures, relpath))
+ self.it(file, function()
+ M.indent_whole_file(file, self.buf_opts, vim.tbl_contains(expected_failures, file))
end)
end
end
@@ -195,8 +193,8 @@ end
function Runner:new_line(file, spec, title, xfail)
title = title and title or tostring(spec.on_line)
self.it(string.format('%s[%s]', file, title), function()
- local path = self.base_dir / file
- M.indent_new_line(path.filename, spec, self.buf_opts, xfail)
+ local path = vim.fs.joinpath(self.base_dir, file)
+ M.indent_new_line(path, spec, self.buf_opts, xfail)
end)
end