From afe34d92a7f28245a96748d70b5e073715b94e22 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 18 Feb 2023 06:50:58 +0800 Subject: vim-patch:9.0.1315: escaping for completion of map command not properly tested Problem: Escaping for completion of map command not properly tested. Solution: Add a few test cases. (closes vim/vim#12009) https://github.com/vim/vim/commit/c3a26c6bff666a368b0a22d35d2e00aa62770f8c --- src/nvim/testdir/test_cmdline.vim | 6 +++++- src/nvim/testdir/test_cpoptions.vim | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 64bfb142e7..d568b5d425 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -330,17 +330,21 @@ func Test_map_completion() call assert_equal('"map ', getreg(':')) call feedkeys(":map \\\"\", 'xt') call assert_equal("\"map \", getreg(':')) + call feedkeys(":map \\\"\", 'xt') + call assert_equal("\"map x", getreg(':')) unmap ,f unmap ,g unmap unmap x - set cpo-=< cpo-=B cpo-=k + set cpo-=< cpo-=k map left call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) call feedkeys(":map \\"\", 'xt') call assert_equal("\"map ", getreg(':')) + call feedkeys(":map \\\\"\", 'xt') + call assert_equal("\"map \x", getreg(':')) unmap " set cpo+=< diff --git a/src/nvim/testdir/test_cpoptions.vim b/src/nvim/testdir/test_cpoptions.vim index 1427c8accc..846671a646 100644 --- a/src/nvim/testdir/test_cpoptions.vim +++ b/src/nvim/testdir/test_cpoptions.vim @@ -68,15 +68,20 @@ endfunc func Test_cpo_B() let save_cpo = &cpo new + imap xk Test set cpo-=B iabbr abc ab\d exe "normal iabc " call assert_equal('abd ', getline(1)) + call feedkeys(":imap x\\\"\", 'tx') + call assert_equal('"imap x\\k', @:) %d set cpo+=B iabbr abc ab\d exe "normal iabc " call assert_equal('abd ', getline(1)) + call feedkeys(":imap x\\\"\", 'tx') + call assert_equal('"imap x\k', @:) close! let &cpo = save_cpo endfunc @@ -195,7 +200,8 @@ func Test_cpo_f() set cpo+=f read test_cpoptions.vim call assert_equal('test_cpoptions.vim', @%) - close! + + bwipe! let &cpo = save_cpo endfunc @@ -428,7 +434,7 @@ func Test_cpo_O() let &cpo = save_cpo endfunc -" Test for the 'p' flag in 'cpo' is in the test_lispwords.vim file. +" Test for the 'p' flag in 'cpo' is in the test_lispindent.vim file. " Test for the 'P' flag in 'cpo' (appending to a file sets the current file " name) @@ -444,7 +450,8 @@ func Test_cpo_P() set cpo+=P write >> XfileCpoP call assert_equal('XfileCpoP', @%) - close! + + bwipe! call delete('XfileCpoP') let &cpo = save_cpo endfunc -- cgit