robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.2 KiB58 linesraw
1-- Test for :execute, :while and :if
2
3local n = require('test.functional.testnvim')()
4local t = require('test.testutil')
5
6local describe, it, setup = t.describe, t.it, t.setup
7local clear = n.clear
8local expect = n.expect
9local source = n.source
10local command = n.command
11
12describe(':execute, :while and :if', function()
13  setup(clear)
14
15  it('is working', function()
16    source([[
17      let i = 0
18      while i < 12
19        let i = i + 1
20        execute "normal o" . i . "\033"
21        if i % 2
22          normal Ax
23          if i == 9
24            break
25          endif
26          if i == 5
27            continue
28          else
29            let j = 9
30            while j > 0
31              execute "normal" j . "a" . j . "\x1b"
32              let j = j - 1
33            endwhile
34          endif
35        endif
36        if i == 9
37          execute "normal Az\033"
38        endif
39      endwhile
40      unlet i j
41    ]])
42
43    -- Remove empty line
44    command('1d')
45
46    -- Assert buffer contents.
47    expect([[
48      1x999999999888888887777777666666555554444333221
49      2
50      3x999999999888888887777777666666555554444333221
51      4
52      5x
53      6
54      7x999999999888888887777777666666555554444333221
55      8
56      9x]])
57  end)
58end)