robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.8 KiB58 linesraw
1-- Tests for adjusting window and contents
2
3local n = require('test.functional.testnvim')()
4local t = require('test.testutil')
5local Screen = require('test.functional.ui.screen')
6
7local describe, it, setup = t.describe, t.it, t.setup
8local poke_eventloop = n.poke_eventloop
9local clear = n.clear
10local insert = n.insert
11local command = n.command
12
13describe('107', function()
14  setup(clear)
15
16  it('is working', function()
17    local screen = Screen.new()
18
19    insert('start:')
20    poke_eventloop()
21    command('new')
22    command('call setline(1, range(1,256))')
23    command('let r=[]')
24    command([[
25      func! GetScreenStr(row)
26         let str = ""
27         for c in range(1,3)
28             let str .= nr2char(screenchar(a:row, c))
29         endfor
30         return str
31      endfunc
32    ]])
33    command([[exe ":norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"]])
34    command('let s3=GetScreenStr(1)')
35    command('wincmd p')
36    command('call add(r, [line("w0"), s3])')
37    command([[exe ":norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"]])
38    command('let s3=GetScreenStr(1)')
39    command('wincmd p')
40    command('call add(r, [line("w0"), s3])')
41    command([[exe ":norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"]])
42    command('let s3=GetScreenStr(1)')
43    command(':wincmd p')
44    command('call add(r, [line("w0"), s3])')
45    command('bwipeout!')
46    command('$put=r')
47    command('call garbagecollect(1)')
48
49    screen:expect([[
50      start:                                               |
51      [1, '1  ']                                           |
52      [50, '50 ']                                          |
53      ^[59, '59 ']                                          |
54      {1:~                                                    }|*9
55      3 more lines                                         |
56    ]])
57  end)
58end)