neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

test_exec_while_if.vim (862B)


      1 " Test for :execute, :while, :for and :if
      2 
      3 func Test_exec_while_if()
      4  new
      5 
      6  let i = 0
      7  while i < 12
      8    let i = i + 1
      9    execute "normal o" . i . "\033"
     10    if i % 2
     11      normal Ax
     12      if i == 9
     13        break
     14      endif
     15      if i == 5
     16        continue
     17      else
     18        let j = 9
     19        while j > 0
     20          execute "normal" j . "a" . j . "\x1b"
     21          let j = j - 1
     22        endwhile
     23      endif
     24    endif
     25    if i == 9
     26      execute "normal Az\033"
     27    endif
     28  endwhile
     29  unlet i j
     30 
     31  call assert_equal(["",
     32        \ "1x999999999888888887777777666666555554444333221",
     33        \ "2",
     34        \ "3x999999999888888887777777666666555554444333221",
     35        \ "4",
     36        \ "5x",
     37        \ "6",
     38        \ "7x999999999888888887777777666666555554444333221",
     39        \ "8",
     40        \ "9x"], getline(1, 10))
     41 endfunc
     42 
     43 " vim: shiftwidth=2 sts=2 expandtab