blob: 3da2784d770d67035f33ec92946d20ad1e362070 [file] [log] [blame]
Bram Moolenaardf365142021-05-03 20:01:45 +02001" Test for :execute, :while, :for and :if
Bram Moolenaar292eff02017-07-11 21:46:28 +02002
Bram Moolenaardf365142021-05-03 20:01:45 +02003func Test_exec_while_if()
Bram Moolenaar292eff02017-07-11 21:46:28 +02004 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 Moolenaardf365142021-05-03 20:01:45 +020053endfunc
Bram Moolenaar6d91bcb2020-08-12 18:50:36 +020054
55" vim: shiftwidth=2 sts=2 expandtab