aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/autochdir_spec.lua
blob: 06f7c1dd11393333091f169b4bd0af0a8ab8bc40 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local lfs = require('lfs')
local helpers = require('test.functional.helpers')(after_each)
local clear, eq = helpers.clear, helpers.eq
local eval, execute = helpers.eval, helpers.execute

describe('autochdir behavior', function()
  local dir = 'Xtest-functional-legacy-autochdir'

  before_each(function()
    lfs.mkdir(dir)
    clear()
  end)

  after_each(function()
    helpers.rmdir(dir)
  end)

  -- Tests vim/vim/777 without test_autochdir().
  it('sets filename', function()
    execute('set acd')
    execute('new')
    execute('w '..dir..'/Xtest')
    eq('Xtest', eval("expand('%')"))
    eq(dir, eval([[substitute(getcwd(), '.*[/\\]\(\k*\)', '\1', '')]]))
  end)
end)