diff src/testdir/test_diffmode.vim @ 19689:da98d2ed8dc5 v8.2.0401

patch 8.2.0401: not enough test coverage for evalvars.c Commit: https://github.com/vim/vim/commit/8dfcce3a78ccb520cc9d09081f998091494c50bf Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 18 19:32:26 2020 +0100 patch 8.2.0401: not enough test coverage for evalvars.c Problem: Not enough test coverage for evalvars.c. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5804)
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 Mar 2020 19:45:04 +0100
parents 0883a37ccf84
children c087099e9163
line wrap: on
line diff
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -1065,3 +1065,32 @@ func Test_diff_maintains_change_mark()
   bwipe!
   bwipe!
 endfunc
+
+" Test for 'patchexpr'
+func Test_patchexpr()
+  let g:patch_args = []
+  func TPatch()
+    call add(g:patch_args, readfile(v:fname_in))
+    call add(g:patch_args, readfile(v:fname_diff))
+    call writefile(['output file'], v:fname_out)
+  endfunc
+  set patchexpr=TPatch()
+
+  call writefile(['input file'], 'Xinput')
+  call writefile(['diff file'], 'Xdiff')
+  %bwipe!
+  edit Xinput
+  diffpatch Xdiff
+  call assert_equal('output file', getline(1))
+  call assert_equal('Xinput.new', bufname())
+  call assert_equal(2, winnr('$'))
+  call assert_true(&diff)
+
+  call delete('Xinput')
+  call delete('Xdiff')
+  set patchexpr&
+  delfunc TPatch
+  %bwipe!
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab