Patch 8.2.4714
Problem:    Using g:filetype_dat and g:filetype_src not tested.
Solution:   Add a test. (Patrick Meiser-Knosowski, closes #10117)
Files:      src/testdir/test_filetype.vim


*** ../vim-8.2.4713/src/testdir/test_filetype.vim       2022-04-07 
16:01:10.482052542 +0100
--- src/testdir/test_filetype.vim       2022-04-08 17:20:17.190371520 +0100
***************
*** 872,893 ****
  func Test_dat_file()
    filetype on
  
    call writefile(['&ACCESS'], 'datfile.dat')
    split datfile.dat
    call assert_equal('krl', &filetype)
    bwipe!
    call delete('datfile.dat')
  
    call writefile(['  DEFDAT datfile'], 'datfile.Dat')
    split datfile.Dat
    call assert_equal('krl', &filetype)
    bwipe!
    call delete('datfile.Dat')
  
!   call writefile(['', 'defdat  datfile'], 'datfile.DAT')
    split datfile.DAT
    call assert_equal('krl', &filetype)
    bwipe!
    call delete('datfile.DAT')
  
    filetype off
--- 872,903 ----
  func Test_dat_file()
    filetype on
  
+   " KRL header start with "&WORD", but is not always present.
    call writefile(['&ACCESS'], 'datfile.dat')
    split datfile.dat
    call assert_equal('krl', &filetype)
    bwipe!
    call delete('datfile.dat')
  
+   " KRL defdat with leading spaces, for KRL file extension is not case
+   " sensitive.
    call writefile(['  DEFDAT datfile'], 'datfile.Dat')
    split datfile.Dat
    call assert_equal('krl', &filetype)
    bwipe!
    call delete('datfile.Dat')
  
!   " KRL defdat with embedded spaces, file starts with empty line(s).
!   call writefile(['', 'defdat  datfile  public'], 'datfile.DAT')
    split datfile.DAT
    call assert_equal('krl', &filetype)
    bwipe!
+ 
+   " User may overrule file inspection
+   let g:filetype_dat = 'dat'
+   split datfile.DAT
+   call assert_equal('dat', &filetype)
+   bwipe!
    call delete('datfile.DAT')
  
    filetype off
***************
*** 1338,1359 ****
--- 1348,1378 ----
  func Test_src_file()
    filetype on
  
+   " KRL header start with "&WORD", but is not always present.
    call writefile(['&ACCESS'], 'srcfile.src')
    split srcfile.src
    call assert_equal('krl', &filetype)
    bwipe!
    call delete('srcfile.src')
  
+   " KRL def with leading spaces, for KRL file extension is not case sensitive.
    call writefile(['  DEF srcfile()'], 'srcfile.Src')
    split srcfile.Src
    call assert_equal('krl', &filetype)
    bwipe!
    call delete('srcfile.Src')
  
+   " KRL global def with embedded spaces, file starts with empty line(s).
    call writefile(['', 'global  def  srcfile()'], 'srcfile.SRC')
    split srcfile.SRC
    call assert_equal('krl', &filetype)
    bwipe!
+ 
+   " User may overrule file inspection
+   let g:filetype_src = 'src'
+   split srcfile.SRC
+   call assert_equal('src', &filetype)
+   bwipe!
    call delete('srcfile.SRC')
  
    filetype off
*** ../vim-8.2.4713/src/version.c       2022-04-08 15:17:53.075952529 +0100
--- src/version.c       2022-04-08 17:19:48.770434070 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4714,
  /**/

-- 
Wi n0t trei a h0liday in Sweden thi yer?
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220408162731.31B7D1C04C0%40moolenaar.net.

Raspunde prin e-mail lui