Bläddra i källkod

Remove listening to BufNewFile autocmd. Add another test

Yegappan Lakshmanan 4 år sedan
förälder
incheckning
084d607a18
2 ändrade filer med 20 tillägg och 1 borttagningar
  1. 0 1
      plugin/mru.vim
  2. 20 0
      test/unit_tests.vim

+ 0 - 1
plugin/mru.vim

@@ -948,7 +948,6 @@ call s:MRU_LoadList()
 " MRU autocommands {{{1
 " Autocommands to update the most recently used files
 autocmd BufRead * call s:MRU_AddFile(expand('<abuf>'))
-autocmd BufNewFile * call s:MRU_AddFile(expand('<abuf>'))
 autocmd BufWritePost * call s:MRU_AddFile(expand('<abuf>'))
 autocmd BufEnter * call s:MRU_AddFile(expand('<abuf>'))
 

+ 20 - 0
test/unit_tests.vim

@@ -1146,6 +1146,7 @@ endfunc
 func Test_40()
   let test_name = 'test40'
   edit file2.txt
+  enew
   MRU
   call search('file2.txt')
   normal d
@@ -1404,6 +1405,25 @@ func Test_48()
   let g:MRU_FuzzyMatch = 1
 endfunc
 
+" ==========================================================================
+" Test49
+" Test for creating a new file by saving an unnamed buffer.
+" ==========================================================================
+func Test_49()
+  let test_name = 'test49'
+  enew | only
+  call setline(1, 'sample file')
+  write sample.txt
+  let l = readfile(g:MRU_File)
+  if match(l, 'sample.txt') != -1
+    call LogResult(test_name, 'pass')
+  else
+    call LogResult(test_name, 'FAIL')
+  endif
+  call delete('sample.txt')
+  bwipe sample.txt
+endfunc
+
 " ==========================================================================
 
 " Create the files used by the tests