comparison src/testdir/test_filetype.vim @ 32477:0a0b9371957f v9.0.1570

patch 9.0.1570: some tests are slow Commit: https://github.com/vim/vim/commit/bf63011a52a3cc32609ae5945665875062a5ae50 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 19 21:41:02 2023 +0100 patch 9.0.1570: some tests are slow Problem: Some tests are slow. Solution: Make a few test cases faster.
author Bram Moolenaar <Bram@vim.org>
date Fri, 19 May 2023 22:45:03 +0200
parents 89abdbbfb27d
children 5bf4fd26c9ac
comparison
equal deleted inserted replaced
32476:2dd215ad5fc2 32477:0a0b9371957f
702 let s:filename_case_checks = { 702 let s:filename_case_checks = {
703 \ 'modula2': ['file.DEF'], 703 \ 'modula2': ['file.DEF'],
704 \ 'bzl': ['file.BUILD', 'BUILD'], 704 \ 'bzl': ['file.BUILD', 'BUILD'],
705 \ } 705 \ }
706 706
707 func CheckItems(checks) 707 def CheckItems(checks: dict<list<string>>)
708 set noswapfile 708 set noswapfile
709 for [ft, names] in items(a:checks) 709
710 for [ft, names] in items(checks)
710 for i in range(0, len(names) - 1) 711 for i in range(0, len(names) - 1)
711 new 712 new
712 try 713 try
713 exe 'edit ' . fnameescape(names[i]) 714 exe 'edit ' .. fnameescape(names[i])
714 catch 715 catch
715 call assert_report('cannot edit "' . names[i] . '": ' . v:exception) 716 assert_report('cannot edit "' .. names[i] .. '": ' .. v:exception)
716 endtry 717 endtry
717 if &filetype == '' && &readonly 718 if &filetype == '' && &readonly
718 " File exists but not able to edit it (permission denied) 719 # File exists but not able to edit it (permission denied)
719 else 720 else
720 let expected = ft == 'none' ? '' : ft 721 var expected = ft == 'none' ? '' : ft
721 call assert_equal(expected, &filetype, 'with file name: ' . names[i]) 722 assert_equal(expected, &filetype, 'with file name: ' .. names[i])
722 endif 723 endif
723 bwipe! 724 bwipe!
724 endfor 725 endfor
725 endfor 726 endfor
727
726 set swapfile& 728 set swapfile&
727 endfunc 729 enddef
728 730
729 func Test_filetype_detection() 731 func Test_filetype_detection()
730 filetype on 732 filetype on
731 call CheckItems(s:filename_checks) 733 call CheckItems(s:filename_checks)
732 if has('fname_case') 734 if has('fname_case')