aboutsummaryrefslogtreecommitdiff
path: root/test/unit/fileio_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2023-12-04 14:32:39 -0800
committerGitHub <noreply@github.com>2023-12-04 14:32:39 -0800
commitc3836e40a2bffbc1d4e06531145b7825788dd818 (patch)
tree895e994179074983789a5f893b96dc75d39f6e6b /test/unit/fileio_spec.lua
parent45fe4d11add933df76a2ea4bf52ce8904f4a778b (diff)
downloadrneovim-c3836e40a2bffbc1d4e06531145b7825788dd818.tar.gz
rneovim-c3836e40a2bffbc1d4e06531145b7825788dd818.tar.bz2
rneovim-c3836e40a2bffbc1d4e06531145b7825788dd818.zip
build: enable lintlua for test/unit/ dir #26396
Problem: Not all Lua code is checked by stylua. Automating code-style is an important mechanism for reducing time spent on accidental (non-essential) complexity. Solution: - Enable lintlua for `test/unit/` directory. - TODO: only `test/functional/` remains unchecked. previous: 45fe4d11add933df76a2ea4bf52ce8904f4a778b previous: 517f0cc634b985057da5b95cf4ad659ee456a77e
Diffstat (limited to 'test/unit/fileio_spec.lua')
-rw-r--r--test/unit/fileio_spec.lua25
1 files changed, 13 insertions, 12 deletions
diff --git a/test/unit/fileio_spec.lua b/test/unit/fileio_spec.lua
index 066d013b19..1284f84222 100644
--- a/test/unit/fileio_spec.lua
+++ b/test/unit/fileio_spec.lua
@@ -1,24 +1,23 @@
-local helpers = require("test.unit.helpers")(after_each)
+local helpers = require('test.unit.helpers')(after_each)
local itp = helpers.gen_itp(it)
--{:cimport, :internalize, :eq, :neq, :ffi, :lib, :cstr, :to_cstr} = require 'test.unit.helpers'
-local eq = helpers.eq
-local ffi = helpers.ffi
+local eq = helpers.eq
+local ffi = helpers.ffi
local to_cstr = helpers.to_cstr
-local NULL = helpers.NULL
+local NULL = helpers.NULL
-local fileio = helpers.cimport("./src/nvim/fileio.h")
+local fileio = helpers.cimport('./src/nvim/fileio.h')
describe('file_pat functions', function()
describe('file_pat_to_reg_pat', function()
-
local file_pat_to_reg_pat = function(pat)
local res = fileio.file_pat_to_reg_pat(to_cstr(pat), NULL, NULL, 0)
return ffi.string(res)
end
itp('returns ^path$ regex for literal path input', function()
- eq( '^path$', file_pat_to_reg_pat('path'))
+ eq('^path$', file_pat_to_reg_pat('path'))
end)
itp('does not prepend ^ when there is a starting glob (*)', function()
@@ -34,13 +33,15 @@ describe('file_pat functions', function()
end)
itp('replaces the bash any character (?) with the regex any character (.)', function()
- eq('^foo.bar$', file_pat_to_reg_pat('foo?bar'))
+ eq('^foo.bar$', file_pat_to_reg_pat('foo?bar'))
end)
- itp('replaces a glob (*) in the middle of a path with regex multiple any character (.*)',
- function()
- eq('^foo.*bar$', file_pat_to_reg_pat('foo*bar'))
- end)
+ itp(
+ 'replaces a glob (*) in the middle of a path with regex multiple any character (.*)',
+ function()
+ eq('^foo.*bar$', file_pat_to_reg_pat('foo*bar'))
+ end
+ )
itp([[unescapes \? to ?]], function()
eq('^foo?bar$', file_pat_to_reg_pat([[foo\?bar]]))