comparison src/testdir/test_filetype.vim @ 32266:769df9d385e0 v9.0.1464

patch 9.0.1464: strace filetype detection is expensive Commit: https://github.com/vim/vim/commit/6e5a9f948221b52caaaf106079cb3430c4dd7c77 Author: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com> Date: Mon Apr 17 22:31:38 2023 +0100 patch 9.0.1464: strace filetype detection is expensive Problem: Strace filetype detection is expensive. Solution: Match with a cheap pattern first. (Federico Mengozzi, closes #12220)
author Bram Moolenaar <Bram@vim.org>
date Mon, 17 Apr 2023 23:45:03 +0200
parents 8e2ecfebd136
children 2df0f9779992
comparison
equal deleted inserted replaced
32265:ca3f9e8b3c03 32266:769df9d385e0
731 call CheckItems(s:filename_case_checks) 731 call CheckItems(s:filename_case_checks)
732 endif 732 endif
733 filetype off 733 filetype off
734 endfunc 734 endfunc
735 735
736 " Content lines that should not result in filetype detection
737 let s:false_positive_checks = {
738 \ '': [['test execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0']],
739 \ }
740
736 " Filetypes detected from the file contents by scripts.vim 741 " Filetypes detected from the file contents by scripts.vim
737 let s:script_checks = { 742 let s:script_checks = {
738 \ 'virata': [['% Virata'], 743 \ 'virata': [['% Virata'],
739 \ ['', '% Virata'], 744 \ ['', '% Virata'],
740 \ ['', '', '% Virata'], 745 \ ['', '', '% Virata'],
822 endfor 827 endfor
823 filetype off 828 filetype off
824 endfunc 829 endfunc
825 830
826 func Test_script_detection() 831 func Test_script_detection()
832 call Run_script_detection(s:false_positive_checks)
827 call Run_script_detection(s:script_checks) 833 call Run_script_detection(s:script_checks)
828 call Run_script_detection(s:script_env_checks) 834 call Run_script_detection(s:script_env_checks)
829 endfunc 835 endfunc
830 836
831 func Test_setfiletype_completion() 837 func Test_setfiletype_completion()