aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/autochdir_spec.lua
blob: 0e293761ad1fe6b863c6a0665586b9769f9542b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local eq = helpers.eq
local getcwd = helpers.funcs.getcwd

describe("'autochdir'", function()
  it('given on the shell gets processed properly', function()
    local targetdir = 'test/functional/fixtures'

    -- By default 'autochdir' is off, thus getcwd() returns the repo root.
    clear(targetdir..'/tty-test.c')
    local rootdir = getcwd()

    -- With 'autochdir' on, we should get the directory of tty-test.c.
    clear('--cmd', 'set autochdir', targetdir..'/tty-test.c')
    eq(rootdir..'/'..targetdir, getcwd())
  end)
end)