blob: d6afabff451fe4525fc1feacfd6b6dd7cc516abc [file] [log] [blame]
Bram Moolenaar292eff02017-07-11 21:46:28 +02001" Test for :execute, :while and :if
2
3function Test_exec_while_if()
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))
53endfunction