vim-patch:8.1.2246: some tests are still in old style

Problem:    Some tests are still in old style.
Solution:   Change a few tests to new style. (Yegappan Lakshmanan)
1f068233c1
This commit is contained in:
Jan Edmund Lazo 2020-10-21 00:04:27 -04:00
parent cb8e0d07b3
commit da5c547ee3
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
4 changed files with 2201 additions and 2342 deletions

View File

@ -1,6 +1,4 @@
Results of test49.vim:
*** Test 16: OK (8722)
*** Test 17: OK (285127993)
*** Test 18: OK (67224583)
*** Test 19: OK (69275973)
*** Test 20: OK (1874575085)
@ -8,16 +6,11 @@ Results of test49.vim:
*** Test 22: OK (4161)
*** Test 23: OK (49)
*** Test 24: OK (41)
*** Test 25: OK (260177811)
*** Test 26: OK (1681500476)
*** Test 27: OK (1996459)
*** Test 28: OK (1996459)
*** Test 29: OK (170428555)
*** Test 30: OK (190905173)
*** Test 31: OK (190905173)
*** Test 32: OK (354833067)
--- Test 33: sum = 178275600 (ok)
*** Test 33: OK (1216907538)
*** Test 34: OK (2146584868)
*** Test 35: OK (2146584868)
*** Test 36: OK (1071644672)
@ -25,17 +18,8 @@ Results of test49.vim:
*** Test 38: OK (357908480)
*** Test 39: OK (357908480)
*** Test 40: OK (357908480)
*** Test 41: OK (3076095)
*** Test 42: OK (1505155949)
*** Test 43: OK (1157763329)
*** Test 44: OK (1031761407)
*** Test 45: OK (1157763329)
*** Test 46: OK (739407)
*** Test 47: OK (371213935)
*** Test 48: OK (756255461)
*** Test 49: OK (179000669)
*** Test 50: OK (363550045)
*** Test 51: OK (40744667)
*** Test 52: OK (1247112011)
*** Test 53: OK (131071)
*** Test 54: OK (2047)
@ -53,13 +37,6 @@ Results of test49.vim:
*** Test 66: OK (5464)
*** Test 67: OK (212514423)
*** Test 68: OK (212514423)
*** Test 69: OK (8995471)
*** Test 70: OK (69544277)
*** Test 71: OK (34886997)
*** Test 72: OK (1789569365)
*** Test 73: OK (9032615)
*** Test 74: OK (224907669)
*** Test 75: OK (2000403408)
*** Test 76: OK (1610087935)
*** Test 77: OK (1388671)
*** Test 78: OK (134217728)
@ -72,11 +49,6 @@ Results of test49.vim:
*** Test 85: OK (198689)
--- Test 86: No Crash for vimgrep on BufUnload
*** Test 86: OK (0)
--- Test 87: 3
--- Test 87: 5
--- Test 87: abcdefghijk
--- Test 87: Successfully executed funcref Add2
*** Test 87: OK (0)
--- Test 88: All tests were run with throwing exceptions on error.
The $VIMNOERRTHROW control is not configured.
--- Test 88: All tests were run with throwing exceptions on interrupt.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -919,9 +919,203 @@ func Test_if_bar_fail()
call assert_equal('acdfh-acfh', g:test15_result)
endfunc
"-------------------------------------------------------------------------------
" Test 16: Double :else or :elseif after :else {{{1
"
" Multiple :elses or an :elseif after an :else are forbidden.
"-------------------------------------------------------------------------------
func T16_F() abort
if 0
Xpath 'a'
else
Xpath 'b'
else " aborts function
Xpath 'c'
endif
Xpath 'd'
endfunc
func T16_G() abort
if 0
Xpath 'a'
else
Xpath 'b'
elseif 1 " aborts function
Xpath 'c'
else
Xpath 'd'
endif
Xpath 'e'
endfunc
func T16_H() abort
if 0
Xpath 'a'
elseif 0
Xpath 'b'
else
Xpath 'c'
else " aborts function
Xpath 'd'
endif
Xpath 'e'
endfunc
func T16_I() abort
if 0
Xpath 'a'
elseif 0
Xpath 'b'
else
Xpath 'c'
elseif 1 " aborts function
Xpath 'd'
else
Xpath 'e'
endif
Xpath 'f'
endfunc
func Test_Multi_Else()
XpathINIT
try
call T16_F()
catch /E583:/
Xpath 'e'
endtry
call assert_equal('be', g:Xpath)
XpathINIT
try
call T16_G()
catch /E584:/
Xpath 'f'
endtry
call assert_equal('bf', g:Xpath)
XpathINIT
try
call T16_H()
catch /E583:/
Xpath 'f'
endtry
call assert_equal('cf', g:Xpath)
XpathINIT
try
call T16_I()
catch /E584:/
Xpath 'g'
endtry
call assert_equal('cg', g:Xpath)
endfunc
"-------------------------------------------------------------------------------
" Test 16: Recognizing {} in variable name. {{{1
" Test 17: Nesting of unmatched :if or :endif inside a :while {{{1
"
" The :while/:endwhile takes precedence in nesting over an unclosed
" :if or an unopened :endif.
"-------------------------------------------------------------------------------
" While loops inside a function are continued on error.
func T17_F()
let loops = 3
while loops > 0
let loops -= 1
Xpath 'a' . loops
if (loops == 1)
Xpath 'b' . loops
continue
elseif (loops == 0)
Xpath 'c' . loops
break
elseif 1
Xpath 'd' . loops
" endif missing!
endwhile " :endwhile after :if 1
Xpath 'e'
endfunc
func T17_G()
let loops = 2
while loops > 0
let loops -= 1
Xpath 'a' . loops
if 0
Xpath 'b' . loops
" endif missing
endwhile " :endwhile after :if 0
endfunc
func T17_H()
let loops = 2
while loops > 0
let loops -= 1
Xpath 'a' . loops
" if missing!
endif " :endif without :if in while
Xpath 'b' . loops
endwhile
endfunc
" Error continuation outside a function is at the outermost :endwhile or :endif.
XpathINIT
let v:errmsg = ''
let loops = 2
while loops > 0
let loops -= 1
Xpath 'a' . loops
if 0
Xpath 'b' . loops
" endif missing! Following :endwhile fails.
endwhile | Xpath 'c'
Xpath 'd'
call assert_match('E171:', v:errmsg)
call assert_equal('a1d', g:Xpath)
func Test_unmatched_if_in_while()
XpathINIT
call assert_fails('call T17_F()', 'E171:')
call assert_equal('a2d2a1b1a0c0e', g:Xpath)
XpathINIT
call assert_fails('call T17_G()', 'E171:')
call assert_equal('a1a0', g:Xpath)
XpathINIT
call assert_fails('call T17_H()', 'E580:')
call assert_equal('a1b1a0b0', g:Xpath)
endfunc
"-------------------------------------------------------------------------------
"-------------------------------------------------------------------------------
"-------------------------------------------------------------------------------
" Test 87 using (expr) ? funcref : funcref {{{1
"
" Vim needs to correctly parse the funcref and even when it does
" not execute the funcref, it needs to consume the trailing ()
"-------------------------------------------------------------------------------
func Add2(x1, x2)
return a:x1 + a:x2
endfu
func GetStr()
return "abcdefghijklmnopqrstuvwxyp"
endfu
func Test_funcref_with_condexpr()
call assert_equal(5, function('Add2')(2,3))
call assert_equal(3, 1 ? function('Add2')(1,2) : function('Add2')(2,3))
call assert_equal(5, 0 ? function('Add2')(1,2) : function('Add2')(2,3))
" Make sure, GetStr() still works.
call assert_equal('abcdefghijk', GetStr()[0:10])
endfunc
"-------------------------------------------------------------------------------
" Test 90: Recognizing {} in variable name. {{{1
"-------------------------------------------------------------------------------
func Test_curlies()
@ -1490,5 +1684,5 @@ endfunc
"-------------------------------------------------------------------------------
" Modelines {{{1
" vim: ts=8 sw=4 tw=80 fdm=marker
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
"-------------------------------------------------------------------------------