robin/laufey

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

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.3 KiB51 linesraw
1local t = require('test.testutil')
2local n = require('test.functional.testnvim')()
3
4local describe, it, before_each, finally = t.describe, t.it, t.before_each, t.finally
5local eq, command, fn = t.eq, n.command, n.fn
6local ok = t.ok
7local matches = t.matches
8local pcall_err = t.pcall_err
9local clear = n.clear
10local feed = n.feed
11
12describe(':edit', function()
13  before_each(function()
14    clear()
15  end)
16
17  it('E77 message', function()
18    local glob_files = { 'Xedit-glob-one.js', 'Xedit-glob-two.js' }
19
20    finally(function()
21      for _, file in ipairs(glob_files) do
22        os.remove(file)
23      end
24    end)
25
26    for _, file in ipairs(glob_files) do
27      t.write_file(file, '')
28    end
29
30    eq(
31      'Vim(edit):E77: Too many file names (glob not allowed)',
32      pcall_err(command, 'edit Xedit-glob-*.js')
33    )
34  end)
35
36  it('without arguments does not restart :terminal buffer', function()
37    command('terminal')
38    feed([[<C-\><C-N>]])
39    local bufname_before = fn.bufname('%')
40    local bufnr_before = fn.bufnr('%')
41    matches('^term://', bufname_before) -- sanity
42
43    command('edit')
44
45    local bufname_after = fn.bufname('%')
46    local bufnr_after = fn.bufnr('%')
47    ok(fn.line('$') > 1)
48    eq(bufname_before, bufname_after)
49    eq(bufnr_before, bufnr_after)
50  end)
51end)