Patch 8.0.1022
Problem:    Test 80 is old style.
Solution:   Turn it into a new style test. (Yegappan Lakshmanan)
Files:      src/Makefile, src/testdir/Make_all.mak, src/testdir/Make_vms.mms,
            src/testdir/test80.in, src/testdir/test80.ok,
            src/testdir/test_substitute.vim


*** ../vim-8.0.1021/src/Makefile        2017-08-29 21:44:55.079627984 +0200
--- src/Makefile        2017-08-30 20:08:15.544579803 +0200
***************
*** 2100,2116 ****
        test_listchars \
        test_search_mbyte \
        test_wordcount \
!       test3 test4 test5 test6 test7 test8 test9 \
!       test11 test12 test14 test15 test17 test18 test19 \
!       test20 test21 test22 test25 test27 test28 test29 \
        test30 test31 test32 test33 test34 test36 test37 test38 test39 \
        test40 test41 test42 test43 test44 test45 test48 test49 \
!       test50 test51 test52 test53 test54 test55 test56 test57 test59 \
        test60 test64 test66 test68 test69 \
!       test70 test72 test73 test74 test77 test78 test79 \
!       test80 test83 test84 test85 test86 test87 test88 \
!       test91 test94 test95 test98 test99 \
!       test100 test101 test103 test104 test107 test108:
        cd testdir; rm -f [email protected]; $(MAKE) -f Makefile [email protected] 
VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
  
  # Run individual NEW style test, assuming that Vim was already compiled.
--- 2100,2116 ----
        test_listchars \
        test_search_mbyte \
        test_wordcount \
!       test3 test4 test5 test7 test8 \
!       test11 test12 test14 test15 test17 test19 \
!       test20 test25 test28 test29 \
        test30 test31 test32 test33 test34 test36 test37 test38 test39 \
        test40 test41 test42 test43 test44 test45 test48 test49 \
!       test50 test52 test53 test54 test55 test56 test57 test59 \
        test60 test64 test66 test68 test69 \
!       test70 test72 test73 test77 test78 test79 \
!       test83 test85 test86 test87 test88 \
!       test94 test95 test99 \
!       test108:
        cd testdir; rm -f [email protected]; $(MAKE) -f Makefile [email protected] 
VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
  
  # Run individual NEW style test, assuming that Vim was already compiled.
*** ../vim-8.0.1021/src/testdir/Make_all.mak    2017-08-29 21:44:55.079627984 
+0200
--- src/testdir/Make_all.mak    2017-08-30 20:08:15.544579803 +0200
***************
*** 50,56 ****
        test70.out \
        test73.out \
        test79.out \
-       test80.out \
        test88.out \
        test94.out \
        test95.out \
--- 50,55 ----
*** ../vim-8.0.1021/src/testdir/Make_vms.mms    2017-08-07 22:02:09.319624624 
+0200
--- src/testdir/Make_vms.mms    2017-08-30 20:08:15.544579803 +0200
***************
*** 86,92 ****
         test64.out \
         test66.out test68.out test69.out \
         test72.out \
!        test77a.out test78.out test79.out test80.out \
         test88.out \
         test94.out \
         test95.out test99.out \
--- 86,92 ----
         test64.out \
         test66.out test68.out test69.out \
         test72.out \
!        test77a.out test78.out test79.out \
         test88.out \
         test94.out \
         test95.out test99.out \
*** ../vim-8.0.1021/src/testdir/test80.in       2016-07-19 18:08:57.000000000 
+0200
--- src/testdir/test80.in       1970-01-01 01:00:00.000000000 +0100
***************
*** 1,201 ****
- Test for *sub-replace-special* and *sub-replace-expression* on substitute().
- Test for submatch() on substitute().
- Test for *:s%* on :substitute.
- 
- STARTTEST
- :so small.vim
- ENDTEST
- 
- TEST_1:
- 
- STARTTEST
- :set magic
- :set cpo&
- :$put =\"\n\nTEST_1:\"
- :$put =substitute('A', 'A', '&&', '')
- :$put =substitute('B', 'B', '\&', '')
- :$put =substitute('C123456789', 
'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '')
- :$put =substitute('D', 'D', 'd', '')
- :$put =substitute('E', 'E', '~', '')
- :$put =substitute('F', 'F', '\~', '')
- :$put =substitute('G', 'G', '\ugg', '')
- :$put =substitute('H', 'H', '\Uh\Eh', '')
- :$put =substitute('I', 'I', '\lII', '')
- :$put =substitute('J', 'J', '\LJ\EJ', '')
- :$put =substitute('K', 'K', '\Uk\ek', '')
- :$put =substitute('lLl', 'L', ' 
', '')
- :$put =substitute('mMm', 'M', '\r', '')
- :$put =substitute('nNn', 'N', '\ 
', '')
- :$put =substitute('oOo', 'O', '\n', '')
- :$put =substitute('pPp', 'P', '\b', '')
- :$put =substitute('qQq', 'Q', '\t', '')
- :$put =substitute('rRr', 'R', '\\', '')
- :$put =substitute('sSs', 'S', '\c', '')
- :$put =substitute('uUu', 'U', \"\n\", '')
- :$put =substitute('vVv', 'V', \"\b\", '')
- :$put =substitute('wWw', 'W', \"\\\", '')
- :$put =substitute('xXx', 'X', \"\r\", '')
- :$put =substitute('Y', 'Y', '\L\uyYy\l\EY', '')
- :$put =substitute('Z', 'Z', '\U\lZzZ\u\Ez', '')
- /^TEST_2
- ENDTEST
- 
- TEST_2:
- 
- STARTTEST
- :set nomagic
- :set cpo&
- :$put =\"\n\nTEST_2:\"
- :$put =substitute('A', 'A', '&&', '')
- :$put =substitute('B', 'B', '\&', '')
- :$put =substitute('C123456789', 
'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', '')
- :$put =substitute('D', 'D', 'd', '')
- :$put =substitute('E', 'E', '~', '')
- :$put =substitute('F', 'F', '\~', '')
- :$put =substitute('G', 'G', '\ugg', '')
- :$put =substitute('H', 'H', '\Uh\Eh', '')
- :$put =substitute('I', 'I', '\lII', '')
- :$put =substitute('J', 'J', '\LJ\EJ', '')
- :$put =substitute('K', 'K', '\Uk\ek', '')
- :$put =substitute('lLl', 'L', ' 
', '')
- :$put =substitute('mMm', 'M', '\r', '')
- :$put =substitute('nNn', 'N', '\ 
', '')
- :$put =substitute('oOo', 'O', '\n', '')
- :$put =substitute('pPp', 'P', '\b', '')
- :$put =substitute('qQq', 'Q', '\t', '')
- :$put =substitute('rRr', 'R', '\\', '')
- :$put =substitute('sSs', 'S', '\c', '')
- :$put =substitute('tTt', 'T', \"\r\", '')
- :$put =substitute('uUu', 'U', \"\n\", '')
- :$put =substitute('vVv', 'V', \"\b\", '')
- :$put =substitute('wWw', 'W', \"\\\", '')
- :$put =substitute('X', 'X', '\L\uxXx\l\EX', '')
- :$put =substitute('Y', 'Y', '\U\lYyY\u\Ey', '')
- /^TEST_3
- ENDTEST
- 
- TEST_3:
- 
- STARTTEST
- :set magic&
- :set cpo&
- :$put =\"\n\nTEST_3:\"
- :let y = substitute('aAa', 'A', '\="\\"', '')           | $put =y
- :let y = substitute('bBb', 'B', '\="\\\\"', '')         | $put =y
- :let y = substitute('cCc', 'C', '\=" 
"', '')         | $put =y
- :let y = substitute('dDd', 'D', '\="\\ 
"', '')       | $put =y
- :let y = substitute('eEe', 'E', '\="\\\\ 
"', '')     | $put =y
- :let y = substitute('fFf', 'F', '\="\\r"', '')          | $put =y
- :let y = substitute('jJj', 'J', '\="\\n"', '')          | $put =y
- :let y = substitute('kKk', 'K', '\="\r"', '')           | $put =y
- :let y = substitute('lLl', 'L', '\="\n"', '')           | $put =y
- /^TEST_4
- ENDTEST
- 
- TEST_4:
- 
- STARTTEST
- :set magic&
- :set cpo&
- :$put =\"\n\nTEST_4:\"
- :let y = substitute('aAa', 'A', '\=substitute(submatch(0), ".", "\\", "")', 
'')       | $put =y
- :let y = substitute('bBb', 'B', '\=substitute(submatch(0), ".", "\\\\", "")', 
'')     | $put =y
- :let y = substitute('cCc', 'C', '\=substitute(submatch(0), ".", " 
", "")', '')     | $put =y
- :let y = substitute('dDd', 'D', '\=substitute(submatch(0), ".", "\\ 
", "")', '')   | $put =y
- :let y = substitute('eEe', 'E', '\=substitute(submatch(0), ".", "\\\\ 
", "")', '') | $put =y
- :let y = substitute('fFf', 'F', '\=substitute(submatch(0), ".", "\\r", "")', 
'')      | $put =y
- :let y = substitute('jJj', 'J', '\=substitute(submatch(0), ".", "\\n", "")', 
'')      | $put =y
- :let y = substitute('kKk', 'K', '\=substitute(submatch(0), ".", "\r", "")', 
'')       | $put =y
- :let y = substitute('lLl', 'L', '\=substitute(submatch(0), ".", "\n", "")', 
'')       | $put =y
- /^TEST_5
- ENDTEST
- 
- TEST_5:
- 
- STARTTEST
- :set magic&
- :set cpo&
- :$put =\"\n\nTEST_5:\"
- :$put =substitute('A123456789', 
'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=submatch(0) . submatch(9) 
. submatch(8) . submatch(7) . submatch(6) . submatch(5) . submatch(4) . 
submatch(3) . submatch(2) . submatch(1)', '')
- :$put =substitute('A123456789', 
'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\=string([submatch(0, 1), 
submatch(9, 1), submatch(8, 1), submatch(7, 1), submatch(6, 1), submatch(5, 1), 
submatch(4, 1), submatch(3, 1), submatch(2, 1), submatch(1, 1)])', '')
- /^TEST_6
- ENDTEST
- 
- TEST_6:
- 
- STARTTEST
- :set magic&
- :$put =\"\n\nTEST_6:\"
- :set cpo+=/
- :$put =substitute('A', 'A', 'a', '')
- :$put =substitute('B', 'B', '%', '')
- :set cpo-=/
- :$put =substitute('C', 'C', 'c', '')
- :$put =substitute('D', 'D', '%', '')
- /^TEST_7
- ENDTEST
- 
- TEST_7:
- 
- STARTTEST
- :set magic&
- :set cpo&
- :$put =\"\n\nTEST_7:\"
- :$put =substitute('A 
A', 'A.', '\=submatch(0)', '')
- :$put =substitute(\"B\nB\", 'B.', '\=submatch(0)', '')
- :$put =substitute(\"B\nB\", 'B.', '\=string(submatch(0, 1))', '')
- :$put =substitute('-bb', '\zeb', 'a', 'g')
- :$put =substitute('-bb', '\ze', 'c', 'g')
- /^TEST_8
- ENDTEST
- 
- TEST_8:
- 
- STARTTEST
- :set magic&
- :set cpo&
- :$put =\"\n\nTEST_8:\"
- :$put =',,X'
- :s/\(^\|,\)\ze\(,\|X\)/\1N/g
- :$put =',,Y'
- :s/\(^\|,\)\ze\(,\|Y\)/\1N/gc
- a:$put =',,Z'
- :s/\(^\|,\)\ze\(,\|Z\)/\1N/gc
- yy/^TEST_9:
- ENDTEST
- 
- TEST_9:
- 
- STARTTEST
- :set magic&
- :set cpo&
- :$put =\"\n\nTEST_9:\"
- :$put ='xxx'
- :s/x/X/gc
- yyq/^TEST_10:
- ENDTEST
- 
- TEST_10:
- 
- STARTTEST
- :set magic&
- :set cpo&
- :$put =\"\n\nTEST_10:\"
- :let y = substitute('123', '\zs', 'a', 'g')             | $put =y
- :let y = substitute('123', '\zs.', 'a', 'g')            | $put =y
- :let y = substitute('123', '.\zs', 'a', 'g')            | $put =y
- :let y = substitute('123', '\ze', 'a', 'g')             | $put =y
- :let y = substitute('123', '\ze.', 'a', 'g')            | $put =y
- :let y = substitute('123', '.\ze', 'a', 'g')            | $put =y
- :let y = substitute('123', '1\|\ze', 'a', 'g')          | $put =y
- :let y = substitute('123', '1\zs\|[23]', 'a', 'g')      | $put =y
- /^TEST_11
- ENDTEST
- 
- TEST_11:
- 
- STARTTEST
- :/^Results/,$wq! test.out
- ENDTEST
- 
- Results of test72:
--- 0 ----
*** ../vim-8.0.1021/src/testdir/test80.ok       2014-04-02 17:52:44.000000000 
+0200
--- src/testdir/test80.ok       1970-01-01 01:00:00.000000000 +0100
***************
*** 1,131 ****
- Results of test72:
- 
- 
- TEST_1:
- AA
- &
- C123456789987654321
- d
- ~
- ~
- Gg
- Hh
- iI
- jJ
- Kk
- l
l
- m
m
- n
n
- o
- o
- p p
- q     q
- r\r
- scs
- u
- u
- v v
- w\w
- x
x
- YyyY
- zZZz
- 
- 
- TEST_2:
- AA
- &
- C123456789987654321
- d
- ~
- ~
- Gg
- Hh
- iI
- jJ
- Kk
- l
l
- m
m
- n
n
- o
- o
- p p
- q     q
- r\r
- scs
- t
t
- u
- u
- v v
- w\w
- XxxX
- yYYy
- 
- 
- TEST_3:
- a\a
- b\\b
- c
c
- d\
d
- e\\
e
- f\rf
- j\nj
- k
k
- l
- l
- 
- 
- TEST_4:
- a\a
- b\b
- c
c
- d
d
- e\
e
- f
f
- j
- j
- k
k
- l
- l
- 
- 
- TEST_5:
- A123456789987654321
- [['A123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'], ['2'], 
['1']]
- 
- 
- TEST_6:
- a
- %
- c
- %
- 
- 
- TEST_7:
- A
A
- B
- B
- ['B
- ']B
- -abab
- c-cbcbc
- 
- 
- TEST_8:
- N,,NX
- N,,NY
- N,,NZ
- 
- 
- TEST_9:
- XXx
- 
- 
- TEST_10:
- a1a2a3a
- aaa
- 1a2a3a
- a1a2a3a
- a1a2a3
- aaa
- aa2a3a
- 1aaa
--- 0 ----
*** ../vim-8.0.1021/src/testdir/test_substitute.vim     2017-02-26 
14:00:03.852862844 +0100
--- src/testdir/test_substitute.vim     2017-08-30 20:20:14.731649182 +0200
***************
*** 114,116 ****
--- 114,296 ----
    call feedkeys("Qsc\<CR>y", 'tx')
    bwipe!
  endfunc
+ 
+ " Test for *sub-replace-special* and *sub-replace-expression* on substitute().
+ func Test_sub_replace_1()
+   " Run the tests with 'magic' on
+   set magic
+   set cpo&
+   call assert_equal('AA', substitute('A', 'A', '&&', ''))
+   call assert_equal('&', substitute('B', 'B', '\&', ''))
+   call assert_equal('C123456789987654321', substitute('C123456789', 
'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', ''))
+   call assert_equal('d', substitute('D', 'D', 'd', ''))
+   call assert_equal('~', substitute('E', 'E', '~', ''))
+   call assert_equal('~', substitute('F', 'F', '\~', ''))
+   call assert_equal('Gg', substitute('G', 'G', '\ugg', ''))
+   call assert_equal('Hh', substitute('H', 'H', '\Uh\Eh', ''))
+   call assert_equal('iI', substitute('I', 'I', '\lII', ''))
+   call assert_equal('jJ', substitute('J', 'J', '\LJ\EJ', ''))
+   call assert_equal('Kk', substitute('K', 'K', '\Uk\ek', ''))
+   call assert_equal("l\<C-V>\<C-M>l",
+                       \ substitute('lLl', 'L', "\<C-V>\<C-M>", ''))
+   call assert_equal("m\<C-M>m", substitute('mMm', 'M', '\r', ''))
+   call assert_equal("n\<C-V>\<C-M>n",
+                       \ substitute('nNn', 'N', "\\\<C-V>\<C-M>", ''))
+   call assert_equal("o\no", substitute('oOo', 'O', '\n', ''))
+   call assert_equal("p\<C-H>p", substitute('pPp', 'P', '\b', ''))
+   call assert_equal("q\tq", substitute('qQq', 'Q', '\t', ''))
+   call assert_equal('r\r', substitute('rRr', 'R', '\\', ''))
+   call assert_equal('scs', substitute('sSs', 'S', '\c', ''))
+   call assert_equal("u\nu", substitute('uUu', 'U', "\n", ''))
+   call assert_equal("v\<C-H>v", substitute('vVv', 'V', "\b", ''))
+   call assert_equal("w\\w", substitute('wWw', 'W', "\\", ''))
+   call assert_equal("x\<C-M>x", substitute('xXx', 'X', "\r", ''))
+   call assert_equal("YyyY", substitute('Y', 'Y', '\L\uyYy\l\EY', ''))
+   call assert_equal("zZZz", substitute('Z', 'Z', '\U\lZzZ\u\Ez', ''))
+ endfunc
+ 
+ func Test_sub_replace_2()
+   " Run the tests with 'magic' off
+   set nomagic
+   set cpo&
+   call assert_equal('AA', substitute('A', 'A', '&&', ''))
+   call assert_equal('&', substitute('B', 'B', '\&', ''))
+   call assert_equal('C123456789987654321', substitute('C123456789', 
'C\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)', '\0\9\8\7\6\5\4\3\2\1', ''))
+   call assert_equal('d', substitute('D', 'D', 'd', ''))
+   call assert_equal('~', substitute('E', 'E', '~', ''))
+   call assert_equal('~', substitute('F', 'F', '\~', ''))
+   call assert_equal('Gg', substitute('G', 'G', '\ugg', ''))
+   call assert_equal('Hh', substitute('H', 'H', '\Uh\Eh', ''))
+   call assert_equal('iI', substitute('I', 'I', '\lII', ''))
+   call assert_equal('jJ', substitute('J', 'J', '\LJ\EJ', ''))
+   call assert_equal('Kk', substitute('K', 'K', '\Uk\ek', ''))
+   call assert_equal("l\<C-V>\<C-M>l",
+                       \ substitute('lLl', 'L', "\<C-V>\<C-M>", ''))
+   call assert_equal("m\<C-M>m", substitute('mMm', 'M', '\r', ''))
+   call assert_equal("n\<C-V>\<C-M>n",
+                       \ substitute('nNn', 'N', "\\\<C-V>\<C-M>", ''))
+   call assert_equal("o\no", substitute('oOo', 'O', '\n', ''))
+   call assert_equal("p\<C-H>p", substitute('pPp', 'P', '\b', ''))
+   call assert_equal("q\tq", substitute('qQq', 'Q', '\t', ''))
+   call assert_equal('r\r', substitute('rRr', 'R', '\\', ''))
+   call assert_equal('scs', substitute('sSs', 'S', '\c', ''))
+   call assert_equal("t\<C-M>t", substitute('tTt', 'T', "\r", ''))
+   call assert_equal("u\nu", substitute('uUu', 'U', "\n", ''))
+   call assert_equal("v\<C-H>v", substitute('vVv', 'V', "\b", ''))
+   call assert_equal('w\w', substitute('wWw', 'W', "\\", ''))
+   call assert_equal('XxxX', substitute('X', 'X', '\L\uxXx\l\EX', ''))
+   call assert_equal('yYYy', substitute('Y', 'Y', '\U\lYyY\u\Ey', ''))
+ endfunc
+ 
+ func Test_sub_replace_3()
+   set magic&
+   set cpo&
+   call assert_equal('a\a', substitute('aAa', 'A', '\="\\"', ''))
+   call assert_equal('b\\b', substitute('bBb', 'B', '\="\\\\"', ''))
+   call assert_equal("c\rc", substitute('cCc', 'C', "\\=\"\r\"", ''))
+   call assert_equal("d\\\rd", substitute('dDd', 'D', "\\=\"\\\\\r\"", ''))
+   call assert_equal("e\\\\\re", substitute('eEe', 'E', "\\=\"\\\\\\\\\r\"", 
''))
+   call assert_equal('f\rf', substitute('fFf', 'F', '\="\\r"', ''))
+   call assert_equal('j\nj', substitute('jJj', 'J', '\="\\n"', ''))
+   call assert_equal("k\<C-M>k", substitute('kKk', 'K', '\="\r"', ''))
+   call assert_equal("l\nl", substitute('lLl', 'L', '\="\n"', ''))
+ endfunc
+ 
+ " Test for submatch() on substitute().
+ func Test_sub_replace_4()
+   set magic&
+   set cpo&
+   call assert_equal('a\a', substitute('aAa', 'A',
+               \ '\=substitute(submatch(0), ".", "\\", "")', ''))
+   call assert_equal('b\b', substitute('bBb', 'B',
+               \ '\=substitute(submatch(0), ".", "\\\\", "")', ''))
+   call assert_equal("c\<C-V>\<C-M>c", substitute('cCc', 'C', 
'\=substitute(submatch(0), ".", "\<C-V>\<C-M>", "")', ''))
+   call assert_equal("d\<C-V>\<C-M>d", substitute('dDd', 'D', 
'\=substitute(submatch(0), ".", "\\\<C-V>\<C-M>", "")', ''))
+   call assert_equal("e\\\<C-V>\<C-M>e", substitute('eEe', 'E', 
'\=substitute(submatch(0), ".", "\\\\\<C-V>\<C-M>", "")', ''))
+   call assert_equal("f\<C-M>f", substitute('fFf', 'F', 
'\=substitute(submatch(0), ".", "\\r", "")', ''))
+   call assert_equal("j\nj", substitute('jJj', 'J', '\=substitute(submatch(0), 
".", "\\n", "")', ''))
+   call assert_equal("k\rk", substitute('kKk', 'K', '\=substitute(submatch(0), 
".", "\r", "")', ''))
+   call assert_equal("l\nl", substitute('lLl', 'L', '\=substitute(submatch(0), 
".", "\n", "")', ''))
+ endfunc
+ 
+ func Test_sub_replace_5()
+   set magic&
+   set cpo&
+   call assert_equal('A123456789987654321', substitute('A123456789',
+               \ 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)',
+               \ '\=submatch(0) . submatch(9) . submatch(8) . ' .
+               \ 'submatch(7) . submatch(6) . submatch(5) . ' .
+               \ 'submatch(4) . submatch(3) . submatch(2) . submatch(1)',
+               \ ''))
+    call assert_equal("[['A123456789'], ['9'], ['8'], ['7'], ['6'], " .
+               \ "['5'], ['4'], ['3'], ['2'], ['1']]",
+               \ substitute('A123456789',
+               \ 'A\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)',
+               \ '\=string([submatch(0, 1), submatch(9, 1), ' .
+               \ 'submatch(8, 1), submatch(7, 1), submatch(6, 1), ' .
+               \ 'submatch(5, 1), submatch(4, 1), submatch(3, 1), ' .
+               \ 'submatch(2, 1), submatch(1, 1)])',
+               \ ''))
+ endfunc
+ 
+ func Test_sub_replace_6()
+   set magic&
+   set cpo+=/
+   call assert_equal('a', substitute('A', 'A', 'a', ''))
+   call assert_equal('%', substitute('B', 'B', '%', ''))
+   set cpo-=/
+   call assert_equal('c', substitute('C', 'C', 'c', ''))
+   call assert_equal('%', substitute('D', 'D', '%', ''))
+ endfunc
+ 
+ func Test_sub_replace_7()
+   set magic&
+   set cpo&
+   call assert_equal('A A', substitute('A A', 'A.', '\=submatch(0)', ''))
+   call assert_equal("B\nB", substitute("B\nB", 'B.', '\=submatch(0)', ''))
+   call assert_equal("['B\n']B", substitute("B\nB", 'B.', 
'\=string(submatch(0, 1))', ''))
+   call assert_equal('-abab', substitute('-bb', '\zeb', 'a', 'g'))
+   call assert_equal('c-cbcbc', substitute('-bb', '\ze', 'c', 'g'))
+ endfunc
+ 
+ " Test for *:s%* on :substitute.
+ func Test_sub_replace_8()
+   new
+   set magic&
+   set cpo&
+   $put =',,X'
+   s/\(^\|,\)\ze\(,\|X\)/\1N/g
+   call assert_equal('N,,NX', getline("$"))
+   $put =',,Y'
+   let cmd = ':s/\(^\|,\)\ze\(,\|Y\)/\1N/gc'
+   call feedkeys(cmd . "\<CR>a", "xt")
+   call assert_equal('N,,NY', getline("$"))
+   :$put =',,Z'
+   let cmd = ':s/\(^\|,\)\ze\(,\|Z\)/\1N/gc'
+   call feedkeys(cmd . "\<CR>yy", "xt")
+   call assert_equal('N,,NZ', getline("$"))
+   enew! | close
+ endfunc
+ 
+ func Test_sub_replace_9()
+   new
+   set magic&
+   set cpo&
+   $put ='xxx'
+   call feedkeys(":s/x/X/gc\<CR>yyq", "xt")
+   call assert_equal('XXx', getline("$"))
+   enew! | close
+ endfunc
+ 
+ func Test_sub_replace_10()
+    set magic&
+    set cpo&
+    call assert_equal('a1a2a3a', substitute('123', '\zs', 'a', 'g'))
+    call assert_equal('aaa', substitute('123', '\zs.', 'a', 'g'))
+    call assert_equal('1a2a3a', substitute('123', '.\zs', 'a', 'g'))
+    call assert_equal('a1a2a3a', substitute('123', '\ze', 'a', 'g'))
+    call assert_equal('a1a2a3', substitute('123', '\ze.', 'a', 'g'))
+    call assert_equal('aaa', substitute('123', '.\ze', 'a', 'g'))
+    call assert_equal('aa2a3a', substitute('123', '1\|\ze', 'a', 'g'))
+    call assert_equal('1aaa', substitute('123', '1\zs\|[23]', 'a', 'g'))
+ endfunc
*** ../vim-8.0.1021/src/version.c       2017-08-30 18:58:59.281206421 +0200
--- src/version.c       2017-08-30 20:21:01.163329139 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     1022,
  /**/

-- 
A day without sunshine is like, well, night.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui