]> granicus.if.org Git - vim/commitdiff
patch 7.4.1030 v7.4.1030
authorBram Moolenaar <Bram@vim.org>
Sat, 2 Jan 2016 18:50:04 +0000 (19:50 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 2 Jan 2016 18:50:04 +0000 (19:50 +0100)
Problem:    test49 is still slow.
Solution:   Move more tests from old to new style.

src/testdir/runtest.vim
src/testdir/test49.ok
src/testdir/test49.vim
src/testdir/test_viml.vim
src/version.c

index b43274c597705eb4287748b4003122d033b49f21..1c4ceadb4c2f8f0f4035ca6f106020cf42264224 100644 (file)
@@ -50,12 +50,17 @@ let done = 0
 let fail = 0
 let errors = []
 let messages = []
-try
+if expand('%') =~ 'test_viml.vim'
+  " this test has intentional errors, don't use try/catch.
   source %
-catch
-  let fail += 1
-  call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
-endtry
+else
+  try
+    source %
+  catch
+    let fail += 1
+    call add(errors, 'Caught exception: ' . v:exception . ' @ ' . v:throwpoint)
+  endtry
+endif
 
 " Locate Test_ functions and execute them.
 redir @q
index 9c3e62638339d894498ede55a17b3bb88dd9bb30..50fc5d2cefb5988d0927bb7e405b26edb81f0b34 100644 (file)
@@ -1,13 +1,4 @@
 Results of test49.vim:
-*** Test   7: OK (90563)
-*** Test   8: OK (562493431)
-*** Test   9: OK (363)
-*** Test  10: OK (559615)
-*** Test  11: OK (2049)
-*** Test  12: OK (352256)
-*** Test  13: OK (145)
-*** Test  14: OK (42413)
-*** Test  15: OK (42413)
 *** Test  16: OK (8722)
 *** Test  17: OK (285127993)
 *** Test  18: OK (67224583)
index df2f3c99423065856d6903fdd7710374f3249553..5973b1c5bb89b7e43f113a738af73e70779e6ffa 100644 (file)
@@ -1,6 +1,6 @@
 " Vim script language tests
 " Author:      Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
-" Last Change: 2015 Dec 30
+" Last Change: 2016 Jan 02
 
 "-------------------------------------------------------------------------------
 " Test environment                                                         {{{1
@@ -608,503 +608,8 @@ com! -nargs=1 -bar ExecAsScript call ExecAsScript(<f-args>)
 " END_OF_TEST_ENVIRONMENT - do not change or remove this line.
 
 
-" Tests 1 to 6 were moved to test_viml.vim
-let Xtest = 7
-
-"-------------------------------------------------------------------------------
-" Test 7:   Continuing on errors outside functions                         {{{1
-"
-"          On an error outside a function, the script processing continues
-"          at the line following the outermost :endif or :endwhile.  When not
-"          inside an :if or :while, the script processing continues at the next
-"          line.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-
-if 1
-    Xpath 1                                    " X: 1
-    while 1
-       Xpath 2                                 " X: 2
-       asdf
-       Xpath 4                                 " X: 0
-       break
-    endwhile | Xpath 8                         " X: 0
-    Xpath 16                                   " X: 0
-endif | Xpath 32                               " X: 0
-Xpath 64                                       " X: 64
-
-while 1
-    Xpath 128                                  " X: 128
-    if 1
-       Xpath 256                               " X: 256
-       asdf
-       Xpath 512                               " X: 0
-    endif | Xpath 1024                         " X: 0
-    Xpath 2048                                 " X: 0
-    break
-endwhile | Xpath 4096                          " X: 0
-Xpath 8192                                     " X: 8192
-
-asdf
-Xpath 16384                                    " X: 16384
-
-asdf | Xpath 32768                             " X: 0
-Xpath 65536                                    " X: 65536
-
-Xcheck 90563
-
-
-"-------------------------------------------------------------------------------
-" Test 8:   Aborting and continuing on errors inside functions             {{{1
-"
-"          On an error inside a function without the "abort" attribute, the
-"          script processing continues at the next line (unless the error was
-"          in a :return command).  On an error inside a function with the
-"          "abort" attribute, the function is aborted and the script processing
-"          continues after the function call; the value -1 is returned then.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-
-function! F()
-    if 1
-       Xpath 1                                 " X: 1
-       while 1
-           Xpath 2                             " X: 2
-           asdf
-           Xpath 4                             " X: 4
-           asdf | Xpath 8                      " X: 0
-           Xpath 16                            " X: 16
-           break
-       endwhile
-       Xpath 32                                " X: 32
-    endif | Xpath 64                           " X: 64
-    Xpath 128                                  " X: 128
-
-    while 1
-       Xpath 256                               " X: 256
-       if 1
-           Xpath 512                           " X: 512
-           asdf
-           Xpath 1024                          " X: 1024
-           asdf | Xpath 2048                   " X: 0
-           Xpath 4096                          " X: 4096
-       endif
-       Xpath 8192                              " X: 8192
-       break
-    endwhile | Xpath 16384                     " X: 16384
-    Xpath 32768                                        " X: 32768
-
-    return novar               " returns (default return value 0)
-    Xpath 65536                                        " X: 0
-    return 1                   " not reached
-endfunction
-
-function! G() abort
-    if 1
-       Xpath 131072                            " X: 131072
-       while 1
-           Xpath 262144                        " X: 262144
-           asdf                " returns -1
-           Xpath 524288                        " X: 0
-           break
-       endwhile
-       Xpath 1048576                           " X: 0
-    endif | Xpath 2097152                      " X: 0
-    Xpath Xpath 4194304                                " X: 0
-
-    return -4                  " not reached
-endfunction
-
-function! H() abort
-    while 1
-       Xpath 8388608                           " X: 8388608
-       if 1
-           Xpath 16777216                      " X: 16777216
-           asdf                " returns -1
-           Xpath 33554432                      " X: 0
-       endif
-       Xpath 67108864                          " X: 0
-       break
-    endwhile | Xpath 134217728                 " X: 0
-    Xpath 268435456                            " X: 0
-
-    return -4                  " not reached
-endfunction
-
-" Aborted functions (G and H) return -1.
-let sum = (F() + 1) - 4*G() - 8*H()
-Xpath 536870912                                        " X: 536870912
-if sum != 13
-    Xpath 1073741824                           " X: 0
-    Xout "sum is" sum
-endif
-
-unlet sum
-delfunction F
-delfunction G
-delfunction H
-
-Xcheck 562493431
-
-
-"-------------------------------------------------------------------------------
-" Test 9:   Continuing after aborted functions                             {{{1
-"
-"          When a function with the "abort" attribute is aborted due to an
-"          error, the next function back in the call hierarchy without an
-"          "abort" attribute continues; the value -1 is returned then.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-
-function! F() abort
-    Xpath 1                                    " X: 1
-    let result = G()   " not aborted
-    Xpath 2                                    " X: 2
-    if result != 2
-       Xpath 4                                 " X: 0
-    endif
-    return 1
-endfunction
-
-function! G()          " no abort attribute
-    Xpath 8                                    " X: 8
-    if H() != -1       " aborted
-       Xpath 16                                " X: 0
-    endif
-    Xpath 32                                   " X: 32
-    return 2
-endfunction
-
-function! H() abort
-    Xpath 64                                   " X: 64
-    call I()           " aborted
-    Xpath 128                                  " X: 0
-    return 4
-endfunction
-
-function! I() abort
-    Xpath 256                                  " X: 256
-    asdf               " error
-    Xpath 512                                  " X: 0
-    return 8
-endfunction
-
-if F() != 1
-    Xpath 1024                                 " X: 0
-endif
-
-delfunction F
-delfunction G
-delfunction H
-delfunction I
-
-Xcheck 363
-
-
-"-------------------------------------------------------------------------------
-" Test 10:  :if, :elseif, :while argument parsing                          {{{1
-"
-"          A '"' or '|' in an argument expression must not be mixed up with
-"          a comment or a next command after a bar.  Parsing errors should
-"          be recognized.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-
-function! MSG(enr, emsg)
-    let english = v:lang == "C" || v:lang =~ '^[Ee]n'
-    if a:enr == ""
-       Xout "TODO: Add message number for:" a:emsg
-       let v:errmsg = ":" . v:errmsg
-    endif
-    let match = 1
-    if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
-       let match = 0
-       if v:errmsg == ""
-           Xout "Message missing."
-       else
-           let v:errmsg = escape(v:errmsg, '"')
-           Xout "Unexpected message:" v:errmsg
-       endif
-    endif
-    return match
-endfunction
-
-if 1 || strlen("\"") | Xpath 1                 " X: 1
-    Xpath 2                                    " X: 2
-endif
-Xpath 4                                                " X: 4
-
-if 0
-elseif 1 || strlen("\"") | Xpath 8             " X: 8
-    Xpath 16                                   " X: 16
-endif
-Xpath 32                                       " X: 32
-
-while 1 || strlen("\"") | Xpath 64             " X: 64
-    Xpath 128                                  " X: 128
-    break
-endwhile
-Xpath 256                                      " X: 256
-
-let v:errmsg = ""
-if 1 ||| strlen("\"") | Xpath 512              " X: 0
-    Xpath 1024                                 " X: 0
-endif
-Xpath 2048                                     " X: 2048
-if !MSG('E15', "Invalid expression")
-    Xpath 4096                                 " X: 0
-endif
-
-let v:errmsg = ""
-if 0
-elseif 1 ||| strlen("\"") | Xpath 8192         " X: 0
-    Xpath 16384                                        " X: 0
-endif
-Xpath 32768                                    " X: 32768
-if !MSG('E15', "Invalid expression")
-    Xpath 65536                                        " X: 0
-endif
-
-let v:errmsg = ""
-while 1 ||| strlen("\"") | Xpath 131072                " X: 0
-    Xpath 262144                               " X: 0
-    break
-endwhile
-Xpath 524288                                   " X: 524288
-if !MSG('E15', "Invalid expression")
-    Xpath 1048576                              " X: 0
-endif
-
-delfunction MSG
-
-Xcheck 559615
-
-
-"-------------------------------------------------------------------------------
-" Test 11:  :if, :elseif, :while argument evaluation after abort           {{{1
-"
-"          When code is skipped over due to an error, the boolean argument to
-"          an :if, :elseif, or :while must not be evaluated.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-
-let calls = 0
-
-function! P(num)
-    let g:calls = g:calls + a:num   " side effect on call
-    return 0
-endfunction
-
-if 1
-    Xpath 1                                    " X: 1
-    asdf               " error
-    Xpath 2                                    " X: 0
-    if P(1)            " should not be called
-       Xpath 4                                 " X: 0
-    elseif !P(2)       " should not be called
-       Xpath 8                                 " X: 0
-    else
-       Xpath 16                                " X: 0
-    endif
-    Xpath 32                                   " X: 0
-    while P(4)         " should not be called
-       Xpath 64                                " X: 0
-    endwhile
-    Xpath 128                                  " X: 0
-endif
-
-if calls % 2
-    Xpath 256                                  " X: 0
-endif
-if (calls/2) % 2
-    Xpath 512                                  " X: 0
-endif
-if (calls/4) % 2
-    Xpath 1024                                 " X: 0
-endif
-Xpath 2048                                     " X: 2048
-
-unlet calls
-delfunction P
-
-Xcheck 2049
-
-
-"-------------------------------------------------------------------------------
-" Test 12:  Expressions in braces in skipped code                          {{{1
-"
-"          In code skipped over due to an error or inactive conditional,
-"          an expression in braces as part of a variable or function name
-"          should not be evaluated.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-
-XloopINIT 1 8
-
-function! NULL()
-    Xloop 1                                    " X: 0
-    return 0
-endfunction
-
-function! ZERO()
-    Xloop 2                                    " X: 0
-    return 0
-endfunction
-
-function! F0()
-    Xloop 4                                    " X: 0
-endfunction
-
-function! F1(arg)
-    Xpath 4096                                 " X: 0
-endfunction
-
-let V0 = 1
-
-Xpath 8192                                     " X: 8192
-echo 0 ? F{NULL() + V{ZERO()}}() : 1
-XloopNEXT
-
-Xpath 16384                                    " X: 16384
-if 0
-    Xpath 32768                                        " X: 0
-    call F{NULL() + V{ZERO()}}()
-endif
-XloopNEXT
-
-Xpath 65536                                    " X: 65536
-if 1
-    asdf               " error
-    Xpath 131072                               " X: 0
-    call F1(F{NULL() + V{ZERO()}}())
-endif
-XloopNEXT
-
-Xpath 262144                                   " X: 262144
-if 1
-    asdf               " error
-    Xpath 524288                               " X: 0
-    call F{NULL() + V{ZERO()}}()
-endif
-
-Xcheck 352256
-
-
-"-------------------------------------------------------------------------------
-" Test 13:  Failure in argument evaluation for :while                      {{{1
-"
-"          A failure in the expression evaluation for the condition of a :while
-"          causes the whole :while loop until the matching :endwhile being
-"          ignored.  Continuation is at the next following line.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-
-Xpath 1                                                " X: 1
-while asdf
-    Xpath 2                                    " X: 0
-    while 1
-       Xpath 4                                 " X: 0
-       break
-    endwhile
-    Xpath 8                                    " X: 0
-    break
-endwhile
-Xpath 16                                       " X: 16
-
-while asdf | Xpath 32 | endwhile | Xpath 64    " X: 0
-Xpath 128                                      " X: 128
-
-Xcheck 145
-
-
-"-------------------------------------------------------------------------------
-" Test 14:  Failure in argument evaluation for :if                         {{{1
-"
-"          A failure in the expression evaluation for the condition of an :if
-"          does not cause the corresponding :else or :endif being matched to
-"          a previous :if/:elseif.  Neither of both branches of the failed :if
-"          are executed.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-XloopINIT 1 256
-
-function! F()
-    Xloop 1                                    " X: 1      + 256 * 1
-    let x = 0
-    if x               " false
-       Xloop 2                                 " X: 0      + 256 * 0
-    elseif !x          " always true
-       Xloop 4                                 " X: 4      + 256 * 4
-       let x = 1
-       if g:boolvar    " possibly undefined
-           Xloop 8                             " X: 8      + 256 * 0
-       else
-           Xloop 16                            " X: 0      + 256 * 0
-       endif
-       Xloop 32                                " X: 32     + 256 * 32
-    elseif x           " never executed
-       Xloop 64                                " X: 0      + 256 * 0
-    endif
-    Xloop 128                                  " X: 128    + 256 * 128
-endfunction
-
-let boolvar = 1
-call F()
-
-XloopNEXT
-unlet boolvar
-call F()
-
-delfunction F
-
-Xcheck 42413
-
-
-"-------------------------------------------------------------------------------
-" Test 15:  Failure in argument evaluation for :if (bar)                   {{{1
-"
-"          Like previous test, except that the failing :if ... | ... | :endif
-"          is in a single line.
-"-------------------------------------------------------------------------------
-
-XpathINIT
-XloopINIT 1 256
-
-function! F()
-    Xloop 1                                    " X: 1      + 256 * 1
-    let x = 0
-    if x               " false
-       Xloop 2                                 " X: 0      + 256 * 0
-    elseif !x          " always true
-       Xloop 4                                 " X: 4      + 256 * 4
-       let x = 1
-       if g:boolvar | Xloop 8 | else | Xloop 16 | endif    " X: 8
-       Xloop 32                                " X: 32     + 256 * 32
-    elseif x           " never executed
-       Xloop 64                                " X: 0      + 256 * 0
-    endif
-    Xloop 128                                  " X: 128    + 256 * 128
-endfunction
-
-let boolvar = 1
-call F()
-
-XloopNEXT
-unlet boolvar
-call F()
-
-delfunction F
-
-Xcheck 42413
-
+" Tests 1 to 15 were moved to test_viml.vim
+let Xtest = 16
 
 "-------------------------------------------------------------------------------
 " Test 16:  Double :else or :elseif after :else                                    {{{1
index 141f48ebd5f436f96656486b6662c527be08e129..5d65953a9e79079282a98ae79e91f36cdd9ba8bc 100644 (file)
@@ -401,6 +401,512 @@ function Test_defining_functions()
     call assert_equal('F1G1F2G21G22G23F3G31G32G33', g:test6_calls)
 endfunc
 
+"-------------------------------------------------------------------------------
+" Test 7:   Continuing on errors outside functions                         {{{1
+"
+"          On an error outside a function, the script processing continues
+"          at the line following the outermost :endif or :endwhile.  When not
+"          inside an :if or :while, the script processing continues at the next
+"          line.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+if 1
+    Xpath 'a'
+    while 1
+       Xpath 'b'
+       asdf
+       Xpath 'c'
+       break
+    endwhile | Xpath 'd'
+    Xpath 'e'
+endif | Xpath 'f'
+Xpath 'g'
+
+while 1
+    Xpath 'h'
+    if 1
+       Xpath 'i'
+       asdf
+       Xpath 'j'
+    endif | Xpath 'k'
+    Xpath 'l'
+    break
+endwhile | Xpath 'm'
+Xpath 'n'
+
+asdf
+Xpath 'o'
+
+asdf | Xpath 'p'
+Xpath 'q'
+
+let g:test7_result = g:Xpath
+
+func Test_error_in_script()
+    call assert_equal('abghinoq', g:test7_result)
+endfunc
+
+"-------------------------------------------------------------------------------
+" Test 8:   Aborting and continuing on errors inside functions             {{{1
+"
+"          On an error inside a function without the "abort" attribute, the
+"          script processing continues at the next line (unless the error was
+"          in a :return command).  On an error inside a function with the
+"          "abort" attribute, the function is aborted and the script processing
+"          continues after the function call; the value -1 is returned then.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+function! T8_F()
+    if 1
+       Xpath 'a'
+       while 1
+           Xpath 'b'
+           asdf
+           Xpath 'c'
+           asdf | Xpath 'd'
+           Xpath 'e'
+           break
+       endwhile
+       Xpath 'f'
+    endif | Xpath 'g'
+    Xpath 'h'
+
+    while 1
+       Xpath 'i'
+       if 1
+           Xpath 'j'
+           asdf
+           Xpath 'k'
+           asdf | Xpath 'l'
+           Xpath 'm'
+       endif
+       Xpath 'n'
+       break
+    endwhile | Xpath 'o'
+    Xpath 'p'
+
+    return novar               " returns (default return value 0)
+    Xpath 'q'
+    return 1                   " not reached
+endfunction
+
+function! T8_G() abort
+    if 1
+       Xpath 'r'
+       while 1
+           Xpath 's'
+           asdf                " returns -1
+           Xpath 't'
+           break
+       endwhile
+       Xpath 'v'
+    endif | Xpath 'w'
+    Xpath 'x'
+
+    return -4                  " not reached
+endfunction
+
+function! T8_H() abort
+    while 1
+       Xpath 'A'
+       if 1
+           Xpath 'B'
+           asdf                " returns -1
+           Xpath 'C'
+       endif
+       Xpath 'D'
+       break
+    endwhile | Xpath 'E'
+    Xpath 'F'
+
+    return -4                  " not reached
+endfunction
+
+" Aborted functions (T8_G and T8_H) return -1.
+let g:test8_sum = (T8_F() + 1) - 4 * T8_G() - 8 * T8_H()
+Xpath 'X'
+let g:test8_result = g:Xpath
+
+func Test_error_in_function()
+    call assert_equal(13, g:test8_sum)
+    call assert_equal('abcefghijkmnoprsABX', g:test8_result)
+
+    delfunction T8_F
+    delfunction T8_G
+    delfunction T8_H
+endfunc
+
+
+"-------------------------------------------------------------------------------
+" Test 9:   Continuing after aborted functions                             {{{1
+"
+"          When a function with the "abort" attribute is aborted due to an
+"          error, the next function back in the call hierarchy without an
+"          "abort" attribute continues; the value -1 is returned then.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+function! F() abort
+    Xpath 'a'
+    let result = G()   " not aborted
+    Xpath 'b'
+    if result != 2
+       Xpath 'c'
+    endif
+    return 1
+endfunction
+
+function! G()          " no abort attribute
+    Xpath 'd'
+    if H() != -1       " aborted
+       Xpath 'e'
+    endif
+    Xpath 'f'
+    return 2
+endfunction
+
+function! H() abort
+    Xpath 'g'
+    call I()           " aborted
+    Xpath 'h'
+    return 4
+endfunction
+
+function! I() abort
+    Xpath 'i'
+    asdf               " error
+    Xpath 'j'
+    return 8
+endfunction
+
+if F() != 1
+    Xpath 'k'
+endif
+
+let g:test9_result = g:Xpath
+
+delfunction F
+delfunction G
+delfunction H
+delfunction I
+
+func Test_func_abort()
+    call assert_equal('adgifb', g:test9_result)
+endfunc
+
+
+"-------------------------------------------------------------------------------
+" Test 10:  :if, :elseif, :while argument parsing                          {{{1
+"
+"          A '"' or '|' in an argument expression must not be mixed up with
+"          a comment or a next command after a bar.  Parsing errors should
+"          be recognized.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+function! MSG(enr, emsg)
+    let english = v:lang == "C" || v:lang =~ '^[Ee]n'
+    if a:enr == ""
+       Xout "TODO: Add message number for:" a:emsg
+       let v:errmsg = ":" . v:errmsg
+    endif
+    let match = 1
+    if v:errmsg !~ '^'.a:enr.':' || (english && v:errmsg !~ a:emsg)
+       let match = 0
+       if v:errmsg == ""
+           Xout "Message missing."
+       else
+           let v:errmsg = escape(v:errmsg, '"')
+           Xout "Unexpected message:" v:errmsg
+       endif
+    endif
+    return match
+endfunction
+
+if 1 || strlen("\"") | Xpath 'a'
+    Xpath 'b'
+endif
+Xpath 'c'
+
+if 0
+elseif 1 || strlen("\"") | Xpath 'd'
+    Xpath 'e'
+endif
+Xpath 'f'
+
+while 1 || strlen("\"") | Xpath 'g'
+    Xpath 'h'
+    break
+endwhile
+Xpath 'i'
+
+let v:errmsg = ""
+if 1 ||| strlen("\"") | Xpath 'j'
+    Xpath 'k'
+endif
+Xpath 'l'
+if !MSG('E15', "Invalid expression")
+    Xpath 'm'
+endif
+
+let v:errmsg = ""
+if 0
+elseif 1 ||| strlen("\"") | Xpath 'n'
+    Xpath 'o'
+endif
+Xpath 'p'
+if !MSG('E15', "Invalid expression")
+    Xpath 'q'
+endif
+
+let v:errmsg = ""
+while 1 ||| strlen("\"") | Xpath 'r'
+    Xpath 's'
+    break
+endwhile
+Xpath 't'
+if !MSG('E15', "Invalid expression")
+    Xpath 'u'
+endif
+
+let g:test10_result = g:Xpath
+delfunction MSG
+
+func Test_expr_parsing()
+    call assert_equal('abcdefghilpt', g:test10_result)
+endfunc
+
+
+"-------------------------------------------------------------------------------
+" Test 11:  :if, :elseif, :while argument evaluation after abort           {{{1
+"
+"          When code is skipped over due to an error, the boolean argument to
+"          an :if, :elseif, or :while must not be evaluated.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+let calls = 0
+
+function! P(num)
+    let g:calls = g:calls + a:num   " side effect on call
+    return 0
+endfunction
+
+if 1
+    Xpath 'a'
+    asdf               " error
+    Xpath 'b'
+    if P(1)            " should not be called
+       Xpath 'c'
+    elseif !P(2)       " should not be called
+       Xpath 'd'
+    else
+       Xpath 'e'
+    endif
+    Xpath 'f'
+    while P(4)         " should not be called
+       Xpath 'g'
+    endwhile
+    Xpath 'h'
+endif
+Xpath 'x'
+
+let g:test11_calls = calls
+let g:test11_result = g:Xpath
+
+unlet calls
+delfunction P
+
+func Test_arg_abort()
+    call assert_equal(0, g:test11_calls)
+    call assert_equal('ax', g:test11_result)
+endfunc
+
+
+"-------------------------------------------------------------------------------
+" Test 12:  Expressions in braces in skipped code                          {{{1
+"
+"          In code skipped over due to an error or inactive conditional,
+"          an expression in braces as part of a variable or function name
+"          should not be evaluated.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+function! NULL()
+    Xpath 'a'
+    return 0
+endfunction
+
+function! ZERO()
+    Xpath 'b'
+    return 0
+endfunction
+
+function! F0()
+    Xpath 'c'
+endfunction
+
+function! F1(arg)
+    Xpath 'e'
+endfunction
+
+let V0 = 1
+
+Xpath 'f'
+echo 0 ? F{NULL() + V{ZERO()}}() : 1
+
+Xpath 'g'
+if 0
+    Xpath 'h'
+    call F{NULL() + V{ZERO()}}()
+endif
+
+Xpath 'i'
+if 1
+    asdf               " error
+    Xpath 'j'
+    call F1(F{NULL() + V{ZERO()}}())
+endif
+
+Xpath 'k'
+if 1
+    asdf               " error
+    Xpath 'l'
+    call F{NULL() + V{ZERO()}}()
+endif
+
+let g:test12_result = g:Xpath
+
+func Test_braces_skipped()
+    call assert_equal('fgik', g:test12_result)
+endfunc
+
+
+"-------------------------------------------------------------------------------
+" Test 13:  Failure in argument evaluation for :while                      {{{1
+"
+"          A failure in the expression evaluation for the condition of a :while
+"          causes the whole :while loop until the matching :endwhile being
+"          ignored.  Continuation is at the next following line.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+Xpath 'a'
+while asdf
+    Xpath 'b'
+    while 1
+       Xpath 'c'
+       break
+    endwhile
+    Xpath 'd'
+    break
+endwhile
+Xpath 'e'
+
+while asdf | Xpath 'f' | endwhile | Xpath 'g'
+Xpath 'h'
+let g:test13_result = g:Xpath
+
+func Test_while_fail()
+    call assert_equal('aeh', g:test13_result)
+endfunc
+
+
+"-------------------------------------------------------------------------------
+" Test 14:  Failure in argument evaluation for :if                         {{{1
+"
+"          A failure in the expression evaluation for the condition of an :if
+"          does not cause the corresponding :else or :endif being matched to
+"          a previous :if/:elseif.  Neither of both branches of the failed :if
+"          are executed.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+function! F()
+    Xpath 'a'
+    let x = 0
+    if x               " false
+       Xpath 'b'
+    elseif !x          " always true
+       Xpath 'c'
+       let x = 1
+       if g:boolvar    " possibly undefined
+           Xpath 'd'
+       else
+           Xpath 'e'
+       endif
+       Xpath 'f'
+    elseif x           " never executed
+       Xpath 'g'
+    endif
+    Xpath 'h'
+endfunction
+
+let boolvar = 1
+call F()
+Xpath '-'
+
+unlet boolvar
+call F()
+let g:test14_result = g:Xpath
+
+delfunction F
+
+func Test_if_fail()
+    call assert_equal('acdfh-acfh', g:test14_result)
+endfunc
+
+
+"-------------------------------------------------------------------------------
+" Test 15:  Failure in argument evaluation for :if (bar)                   {{{1
+"
+"          Like previous test, except that the failing :if ... | ... | :endif
+"          is in a single line.
+"-------------------------------------------------------------------------------
+
+XpathINIT
+
+function! F()
+    Xpath 'a'
+    let x = 0
+    if x               " false
+       Xpath 'b'
+    elseif !x          " always true
+       Xpath 'c'
+       let x = 1
+       if g:boolvar | Xpath 'd' | else | Xpath 'e' | endif
+       Xpath 'f'
+    elseif x           " never executed
+       Xpath 'g'
+    endif
+    Xpath 'h'
+endfunction
+
+let boolvar = 1
+call F()
+Xpath '-'
+
+unlet boolvar
+call F()
+let g:test15_result = g:Xpath
+
+delfunction F
+
+func Test_if_bar_fail()
+    call assert_equal('acdfh-acfh', g:test15_result)
+endfunc
+
+
 "-------------------------------------------------------------------------------
 " Modelines                                                                {{{1
 " vim: ts=8 sw=4 tw=80 fdm=marker
index 3867e08971f99aca9665bf19d7681114f9be97d4..79677a1b031b3c3ed1e224a007e276f84f5a014a 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1030,
 /**/
     1029,
 /**/