diff src/testdir/test_substitute.vim @ 15760:aa80c63f34bb v8.1.0887

patch 8.1.0887: the 'l' flag in :subsitute is sticky commit https://github.com/vim/vim/commit/9474716d39764ac5642e55b5548580cf53bd9bed Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 10 21:55:26 2019 +0100 patch 8.1.0887: the 'l' flag in :subsitute is sticky Problem: The 'l' flag in :subsitute is sticky. Solution: Reset the flag. (Dominique Pelle, closes https://github.com/vim/vim/issues/3925)
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Feb 2019 22:00:08 +0100
parents 63b02fcf1361
children ed264e126766
line wrap: on
line diff
--- a/src/testdir/test_substitute.vim
+++ b/src/testdir/test_substitute.vim
@@ -107,6 +107,32 @@ func Test_substitute_variants()
   endfor
 endfunc
 
+" Test the l, p, # flags.
+func Test_substitute_flags_lp()
+  new
+  call setline(1, "abc\tdef\<C-h>ghi")
+
+  let a = execute('s/a/a/p')
+  call assert_equal("\nabc     def^Hghi", a)
+
+  let a = execute('s/a/a/l')
+  call assert_equal("\nabc^Idef^Hghi$", a)
+
+  let a = execute('s/a/a/#')
+  call assert_equal("\n  1 abc     def^Hghi", a)
+
+  let a = execute('s/a/a/p#')
+  call assert_equal("\n  1 abc     def^Hghi", a)
+
+  let a = execute('s/a/a/l#')
+  call assert_equal("\n  1 abc^Idef^Hghi$", a)
+
+  let a = execute('s/a/a/')
+  call assert_equal("", a)
+
+  bwipe!
+endfunc
+
 func Test_substitute_repeat()
   " This caused an invalid memory access.
   split Xfile