Mercurial > vim
comparison src/testdir/test_filetype.vim @ 20756:33a14786a0e4 v8.2.0930
patch 8.2.0930: script filetype detection trips over env -S argument
Commit: https://github.com/vim/vim/commit/b5e18f29fac9253b0ccf1fde5e74bff72fa1ba60
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 7 21:58:54 2020 +0200
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 https://github.com/vim/vim/issues/5013)
Add tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 07 Jun 2020 22:00:04 +0200 |
parents | dae1811e84dd |
children | ad15725594f8 |
comparison
equal
deleted
inserted
replaced
20755:c3f999111bfd | 20756:33a14786a0e4 |
---|---|
605 \ 'cpp': [['// Standard iostream objects -*- C++ -*-'], | 605 \ 'cpp': [['// Standard iostream objects -*- C++ -*-'], |
606 \ ['// -*- C++ -*-']], | 606 \ ['// -*- C++ -*-']], |
607 \ 'yaml': [['%YAML 1.2']], | 607 \ 'yaml': [['%YAML 1.2']], |
608 \ } | 608 \ } |
609 | 609 |
610 func Test_script_detection() | 610 " Various forms of "env" optional arguments. |
611 let s:script_env_checks = { | |
612 \ 'perl': [['#!/usr/bin/env VAR=val perl']], | |
613 \ 'scala': [['#!/usr/bin/env VAR=val VVAR=vval scala']], | |
614 \ 'awk': [['#!/usr/bin/env VAR=val -i awk']], | |
615 \ 'scheme': [['#!/usr/bin/env VAR=val --ignore-environment scheme']], | |
616 \ 'python': [['#!/usr/bin/env VAR=val -S python -w -T']], | |
617 \ 'wml': [['#!/usr/bin/env VAR=val --split-string wml']], | |
618 \ } | |
619 | |
620 func Run_script_detection(test_dict) | |
611 filetype on | 621 filetype on |
612 for [ft, files] in items(s:script_checks) | 622 for [ft, files] in items(a:test_dict) |
613 for file in files | 623 for file in files |
614 call writefile(file, 'Xtest') | 624 call writefile(file, 'Xtest') |
615 split Xtest | 625 split Xtest |
616 call assert_equal(ft, &filetype, 'for text: ' . string(file)) | 626 call assert_equal(ft, &filetype, 'for text: ' . string(file)) |
617 bwipe! | 627 bwipe! |
618 endfor | 628 endfor |
619 endfor | 629 endfor |
620 call delete('Xtest') | 630 call delete('Xtest') |
621 filetype off | 631 filetype off |
632 endfunc | |
633 | |
634 func Test_script_detection() | |
635 call Run_script_detection(s:script_checks) | |
636 call Run_script_detection(s:script_env_checks) | |
622 endfunc | 637 endfunc |
623 | 638 |
624 func Test_setfiletype_completion() | 639 func Test_setfiletype_completion() |
625 call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx') | 640 call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx') |
626 call assert_equal('"setfiletype java javacc javascript javascriptreact', @:) | 641 call assert_equal('"setfiletype java javacc javascript javascriptreact', @:) |