Bram Moolenaar | df36514 | 2021-05-03 20:01:45 +0200 | [diff] [blame^] | 1 | " Test for :execute, :while, :for and :if |
Bram Moolenaar | 292eff0 | 2017-07-11 21:46:28 +0200 | [diff] [blame] | 2 | |
Bram Moolenaar | df36514 | 2021-05-03 20:01:45 +0200 | [diff] [blame^] | 3 | func Test_exec_while_if() |
Bram Moolenaar | 292eff0 | 2017-07-11 21:46:28 +0200 | [diff] [blame] | 4 | new |
| 5 | |
| 6 | let i = 0 |
| 7 | while i < 12 |
| 8 | let i = i + 1 |
| 9 | if has("ebcdic") |
| 10 | execute "normal o" . i . "\047" |
| 11 | else |
| 12 | execute "normal o" . i . "\033" |
| 13 | endif |
| 14 | if i % 2 |
| 15 | normal Ax |
| 16 | if i == 9 |
| 17 | break |
| 18 | endif |
| 19 | if i == 5 |
| 20 | continue |
| 21 | else |
| 22 | let j = 9 |
| 23 | while j > 0 |
| 24 | if has("ebcdic") |
| 25 | execute "normal" j . "a" . j . "\x27" |
| 26 | else |
| 27 | execute "normal" j . "a" . j . "\x1b" |
| 28 | endif |
| 29 | let j = j - 1 |
| 30 | endwhile |
| 31 | endif |
| 32 | endif |
| 33 | if i == 9 |
| 34 | if has("ebcdic") |
| 35 | execute "normal Az\047" |
| 36 | else |
| 37 | execute "normal Az\033" |
| 38 | endif |
| 39 | endif |
| 40 | endwhile |
| 41 | unlet i j |
| 42 | |
| 43 | call assert_equal(["", |
| 44 | \ "1x999999999888888887777777666666555554444333221", |
| 45 | \ "2", |
| 46 | \ "3x999999999888888887777777666666555554444333221", |
| 47 | \ "4", |
| 48 | \ "5x", |
| 49 | \ "6", |
| 50 | \ "7x999999999888888887777777666666555554444333221", |
| 51 | \ "8", |
| 52 | \ "9x"], getline(1, 10)) |
Bram Moolenaar | df36514 | 2021-05-03 20:01:45 +0200 | [diff] [blame^] | 53 | endfunc |
Bram Moolenaar | 6d91bcb | 2020-08-12 18:50:36 +0200 | [diff] [blame] | 54 | |
| 55 | " vim: shiftwidth=2 sts=2 expandtab |