robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.0 KiB41 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3
4local describe, it, before_each = t.describe, t.it, t.before_each
5local eq = t.eq
6local eval = n.eval
7local feed = n.feed
8local clear = n.clear
9local command = n.command
10
11describe('v:count/v:count1', function()
12  before_each(function()
13    clear()
14
15    command('map <silent> _x :<C-u>let g:count = "v:count=". v:count .", v:count1=". v:count1<CR>')
16  end)
17
18  describe('in cmdwin', function()
19    it('equal 0/1 when no count is given', function()
20      feed('q:_x')
21      eq('v:count=0, v:count1=1', eval('g:count'))
22    end)
23
24    it('equal 2/2 when count of 2 is given', function()
25      feed('q:2_x')
26      eq('v:count=2, v:count1=2', eval('g:count'))
27    end)
28  end)
29
30  describe('in normal mode', function()
31    it('equal 0/1 when no count is given', function()
32      feed('_x')
33      eq('v:count=0, v:count1=1', eval('g:count'))
34    end)
35
36    it('equal 2/2 when count of 2 is given', function()
37      feed('2_x')
38      eq('v:count=2, v:count1=2', eval('g:count'))
39    end)
40  end)
41end)