diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-06-07 18:56:28 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-06-18 18:01:42 -0400 |
commit | 9d565c5ba3866fd5e754daef26f2937ed8193836 (patch) | |
tree | df3bad1dd01c4d71f9d69a2b9230916723249351 /src | |
parent | 150168b8814537c77fa005cee107b551718a7245 (diff) | |
download | rneovim-9d565c5ba3866fd5e754daef26f2937ed8193836.tar.gz rneovim-9d565c5ba3866fd5e754daef26f2937ed8193836.tar.bz2 rneovim-9d565c5ba3866fd5e754daef26f2937ed8193836.zip |
vim-patch:8.2.0930: script filetype detection trips over env -S argument
Problem: Script filetype detection trips over env -S argument.
Solution: Remove "-S" and "--ignore-environment". (closes vim/vim#5013)
Add tests.
https://github.com/vim/vim/commit/b5e18f29fac9253b0ccf1fde5e74bff72fa1ba60
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index a9e43b9aca..3867434b3a 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -606,9 +606,19 @@ let s:script_checks = { \ 'yaml': [['%YAML 1.2']], \ } -func Test_script_detection() +" Various forms of "env" optional arguments. +let s:script_env_checks = { + \ 'perl': [['#!/usr/bin/env VAR=val perl']], + \ 'scala': [['#!/usr/bin/env VAR=val VVAR=vval scala']], + \ 'awk': [['#!/usr/bin/env VAR=val -i awk']], + \ 'scheme': [['#!/usr/bin/env VAR=val --ignore-environment scheme']], + \ 'python': [['#!/usr/bin/env VAR=val -S python -w -T']], + \ 'wml': [['#!/usr/bin/env VAR=val --split-string wml']], + \ } + +func Run_script_detection(test_dict) filetype on - for [ft, files] in items(s:script_checks) + for [ft, files] in items(a:test_dict) for file in files call writefile(file, 'Xtest') split Xtest @@ -620,6 +630,11 @@ func Test_script_detection() filetype off endfunc +func Test_script_detection() + call Run_script_detection(s:script_checks) + call Run_script_detection(s:script_env_checks) +endfunc + func Test_setfiletype_completion() call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx') call assert_equal('"setfiletype java javacc javascript javascriptreact', @:) |