diff options
author | Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> | 2023-02-11 16:08:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-11 08:08:33 -0700 |
commit | 9668c166e88cd71e517cacfb8d266b75047604f7 (patch) | |
tree | f1ef1be6110adb72472014cce47c5a09402f3c05 /test | |
parent | 24ec0aaa7a1589fd4b67dc44f201842900d81c89 (diff) | |
download | rneovim-9668c166e88cd71e517cacfb8d266b75047604f7.tar.gz rneovim-9668c166e88cd71e517cacfb8d266b75047604f7.tar.bz2 rneovim-9668c166e88cd71e517cacfb8d266b75047604f7.zip |
fix(filetype): make vim.filetype.match() work with contents only (#22181)
Co-authored-by: Gregory Anders <greg@gpanders.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/lua/filetype_spec.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua index 2a7be53164..034665f717 100644 --- a/test/functional/lua/filetype_spec.lua +++ b/test/functional/lua/filetype_spec.lua @@ -94,6 +94,14 @@ describe('vim.filetype', function() return vim.filetype.match({ buf = 0 }) ]]) end) + + it('works with contents #22180', function() + eq('sh', exec_lua [[ + -- Needs to be set so detect#sh doesn't fail + vim.g.ft_ignore_pat = "\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$" + return vim.filetype.match({ contents = { '#!/usr/bin/env bash' } }) + ]]) + end) end) describe('filetype.lua', function() |