test_exec_while_if.vim 862 B

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