aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/health/nvim.vim2
-rw-r--r--src/nvim/buffer.c7
-rw-r--r--src/nvim/fileio.c60
-rw-r--r--src/nvim/screen.c4
-rw-r--r--src/nvim/testdir/test_fileformat.vim16
-rw-r--r--src/nvim/version.c8
-rw-r--r--src/nvim/window.c18
-rw-r--r--test/functional/terminal/mouse_spec.lua28
-rw-r--r--test/functional/terminal/window_split_tab_spec.lua91
-rw-r--r--test/unit/path_spec.lua132
10 files changed, 193 insertions, 173 deletions
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 3d871faf5d..58033f0405 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -58,7 +58,7 @@ function! s:check_rplugin_manifest() abort
let contents = join(readfile(script))
if contents =~# '\<\%(from\|import\)\s\+neovim\>'
if script =~# '[\/]__init__\.py$'
- let script = fnamemodify(script, ':h')
+ let script = tr(fnamemodify(script, ':h'), '\', '/')
endif
if !has_key(existing_rplugins, script)
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index f874268910..766003a021 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -64,7 +64,6 @@
#include "nvim/spell.h"
#include "nvim/strings.h"
#include "nvim/syntax.h"
-#include "nvim/terminal.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
#include "nvim/version.h"
@@ -1464,12 +1463,6 @@ void enter_buffer(buf_T *buf)
/* mark cursor position as being invalid */
curwin->w_valid = 0;
- if (buf->terminal) {
- terminal_resize(buf->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
- (uint16_t)curwin->w_height);
- }
-
/* Make sure the buffer is loaded. */
if (curbuf->b_ml.ml_mfp == NULL) { /* need to load the file */
/* If there is no filetype, allow for detecting one. Esp. useful for
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index feb16f44d4..a7676e88f0 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -302,12 +302,9 @@ readfile (
linenr_T skip_count = 0;
linenr_T read_count = 0;
int msg_save = msg_scroll;
- linenr_T read_no_eol_lnum = 0; /* non-zero lnum when last line of
- * last read was missing the eol */
- int try_mac = (vim_strchr(p_ffs, 'm') != NULL);
- int try_dos = (vim_strchr(p_ffs, 'd') != NULL);
- int try_unix = (vim_strchr(p_ffs, 'x') != NULL);
- int file_rewind = FALSE;
+ linenr_T read_no_eol_lnum = 0; // non-zero lnum when last line of
+ // last read was missing the eol
+ int file_rewind = false;
int can_retry;
linenr_T conv_error = 0; /* line nr with conversion error */
linenr_T illegal_byte = 0; /* line nr with illegal byte */
@@ -639,37 +636,46 @@ readfile (
curbuf->b_op_start.lnum = ((from == 0) ? 1 : from);
curbuf->b_op_start.col = 0;
+ int try_mac = (vim_strchr(p_ffs, 'm') != NULL);
+ int try_dos = (vim_strchr(p_ffs, 'd') != NULL);
+ int try_unix = (vim_strchr(p_ffs, 'x') != NULL);
+
if (!read_buffer) {
int m = msg_scroll;
int n = msg_scrolled;
- /*
- * The file must be closed again, the autocommands may want to change
- * the file before reading it.
- */
- if (!read_stdin)
- close(fd); /* ignore errors */
+ // The file must be closed again, the autocommands may want to change
+ // the file before reading it.
+ if (!read_stdin) {
+ close(fd); // ignore errors
+ }
- /*
- * The output from the autocommands should not overwrite anything and
- * should not be overwritten: Set msg_scroll, restore its value if no
- * output was done.
- */
- msg_scroll = TRUE;
- if (filtering)
+ // The output from the autocommands should not overwrite anything and
+ // should not be overwritten: Set msg_scroll, restore its value if no
+ // output was done.
+ msg_scroll = true;
+ if (filtering) {
apply_autocmds_exarg(EVENT_FILTERREADPRE, NULL, sfname,
- FALSE, curbuf, eap);
- else if (read_stdin)
+ false, curbuf, eap);
+ } else if (read_stdin) {
apply_autocmds_exarg(EVENT_STDINREADPRE, NULL, sfname,
- FALSE, curbuf, eap);
- else if (newfile)
+ false, curbuf, eap);
+ } else if (newfile) {
apply_autocmds_exarg(EVENT_BUFREADPRE, NULL, sfname,
- FALSE, curbuf, eap);
- else
+ false, curbuf, eap);
+ } else {
apply_autocmds_exarg(EVENT_FILEREADPRE, sfname, sfname,
- FALSE, NULL, eap);
- if (msg_scrolled == n)
+ false, NULL, eap);
+ }
+
+ // autocommands may have changed it
+ try_mac = (vim_strchr(p_ffs, 'm') != NULL);
+ try_dos = (vim_strchr(p_ffs, 'd') != NULL);
+ try_unix = (vim_strchr(p_ffs, 'x') != NULL);
+
+ if (msg_scrolled == n) {
msg_scroll = m;
+ }
if (aborting()) { /* autocmds may abort script processing */
--no_wait_return;
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 41e900eb4c..ed96e98d32 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -696,8 +696,8 @@ static void win_update(win_T *wp)
if (buf->terminal) {
terminal_resize(buf->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
- (uint16_t)curwin->w_height);
+ (uint16_t)(MAX(0, wp->w_width - win_col_off(wp))),
+ (uint16_t)wp->w_height);
}
} else if (buf->b_mod_set
&& buf->b_mod_xlines != 0
diff --git a/src/nvim/testdir/test_fileformat.vim b/src/nvim/testdir/test_fileformat.vim
index 584f20cdfc..de505d3bd0 100644
--- a/src/nvim/testdir/test_fileformat.vim
+++ b/src/nvim/testdir/test_fileformat.vim
@@ -15,3 +15,19 @@ func Test_fileformat_after_bw()
call assert_equal(test_fileformats, &fileformat)
set fileformats&
endfunc
+
+func Test_fileformat_autocommand()
+ let filecnt = ["\<CR>", "foobar\<CR>", "eins\<CR>", "\<CR>", "zwei\<CR>", "drei", "vier", "fünf", ""]
+ let ffs = &ffs
+ call writefile(filecnt, 'Xfile', 'b')
+ au BufReadPre Xfile set ffs=dos ff=dos
+ new Xfile
+ call assert_equal('dos', &l:ff)
+ call assert_equal('dos', &ffs)
+
+ " cleanup
+ call delete('Xfile')
+ let &ffs = ffs
+ au! BufReadPre Xfile
+ bw!
+endfunc
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 05725a59f9..5accf8f1d6 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -856,10 +856,10 @@ static const int included_patches[] = {
// 251,
250,
// 249 NA
- // 248,
+ // 248 NA
247,
// 246 NA
- // 245,
+ 245,
// 244,
243,
242,
@@ -878,9 +878,9 @@ static const int included_patches[] = {
229,
// 228,
// 227,
- // 226,
+ 226,
// 225,
- // 224,
+ 224,
223,
// 222,
// 221 NA
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2d64409a1c..4e4eb297aa 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1846,12 +1846,6 @@ static bool close_last_window_tabpage(win_T *win, bool free_buf,
shell_new_rows();
}
- if (term) {
- // When a window containing a terminal buffer is closed, recalculate its
- // size
- terminal_resize(term, 0, 0);
- }
-
// Since goto_tabpage_tp above did not trigger *Enter autocommands, do
// that now.
apply_autocmds(EVENT_TABCLOSED, prev_idx, prev_idx, false, curbuf);
@@ -3745,12 +3739,6 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
/* Change directories when the 'acd' option is set. */
do_autochdir();
-
- if (curbuf->terminal) {
- terminal_resize(curbuf->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
- (uint16_t)curwin->w_height);
- }
}
@@ -4930,9 +4918,7 @@ void scroll_to_fraction(win_T *wp, int prev_height)
}
}
-/*
- * Set the width of a window.
- */
+/// Set the width of a window.
void win_new_width(win_T *wp, int width)
{
wp->w_width = width;
@@ -4949,7 +4935,7 @@ void win_new_width(win_T *wp, int width)
if (wp->w_buffer->terminal) {
if (wp->w_height != 0) {
terminal_resize(wp->w_buffer->terminal,
- (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
+ (uint16_t)(MAX(0, wp->w_width - win_col_off(wp))),
0);
}
}
diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua
index 29c62d7be7..5e5558ee0a 100644
--- a/test/functional/terminal/mouse_spec.lua
+++ b/test/functional/terminal/mouse_spec.lua
@@ -101,7 +101,7 @@ describe('terminal mouse', function()
line28 |line28 |
line29 |line29 |
line30 |line30 |
- rows: 5, cols: 25 |rows: 5, cols: 25 |
+ rows: 5, cols: 24 |rows: 5, cols: 24 |
{2:^ } |{2: } |
========== ========== |
:vsp |
@@ -111,7 +111,7 @@ describe('terminal mouse', function()
{7: 1 }^ |line28 |
{4:~ }|line29 |
{4:~ }|line30 |
- {4:~ }|rows: 5, cols: 25 |
+ {4:~ }|rows: 5, cols: 24 |
{4:~ }|{2: } |
========== ========== |
:enew | set number |
@@ -121,16 +121,16 @@ describe('terminal mouse', function()
{7: 27 }line |line28 |
{7: 28 }line |line29 |
{7: 29 }line |line30 |
- {7: 30 }line |rows: 5, cols: 25 |
+ {7: 30 }line |rows: 5, cols: 24 |
{7: 31 }^ |{2: } |
========== ========== |
|
]])
feed('<c-w>li')
screen:expect([[
- {7: 27 }line |line29 |
- {7: 28 }line |line30 |
- {7: 29 }line |rows: 5, cols: 25 |
+ {7: 27 }line |line28 |
+ {7: 28 }line |line29 |
+ {7: 29 }line |line30 |
{7: 30 }line |rows: 5, cols: 24 |
{7: 31 } |{1: } |
========== ========== |
@@ -140,8 +140,8 @@ describe('terminal mouse', function()
thelpers.enable_mouse()
thelpers.feed_data('mouse enabled\n')
screen:expect([[
- {7: 27 }line |line30 |
- {7: 28 }line |rows: 5, cols: 25 |
+ {7: 27 }line |line29 |
+ {7: 28 }line |line30 |
{7: 29 }line |rows: 5, cols: 24 |
{7: 30 }line |mouse enabled |
{7: 31 } |{1: } |
@@ -153,8 +153,8 @@ describe('terminal mouse', function()
it('wont lose focus if another window is scrolled', function()
feed('<ScrollWheelUp><0,0><ScrollWheelUp><0,0>')
screen:expect([[
- {7: 21 }line |line30 |
- {7: 22 }line |rows: 5, cols: 25 |
+ {7: 21 }line |line29 |
+ {7: 22 }line |line30 |
{7: 23 }line |rows: 5, cols: 24 |
{7: 24 }line |mouse enabled |
{7: 25 }line |{1: } |
@@ -163,8 +163,8 @@ describe('terminal mouse', function()
]])
feed('<S-ScrollWheelDown><0,0>')
screen:expect([[
- {7: 26 }line |line30 |
- {7: 27 }line |rows: 5, cols: 25 |
+ {7: 26 }line |line29 |
+ {7: 27 }line |line30 |
{7: 28 }line |rows: 5, cols: 24 |
{7: 29 }line |mouse enabled |
{7: 30 }line |{1: } |
@@ -176,8 +176,8 @@ describe('terminal mouse', function()
it('will lose focus if another window is clicked', function()
feed('<LeftMouse><5,1>')
screen:expect([[
- {7: 27 }line |line30 |
- {7: 28 }l^ine |rows: 5, cols: 25 |
+ {7: 27 }line |line29 |
+ {7: 28 }l^ine |line30 |
{7: 29 }line |rows: 5, cols: 24 |
{7: 30 }line |mouse enabled |
{7: 31 } |{2: } |
diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua
index c5199f620e..714c2476ce 100644
--- a/test/functional/terminal/window_split_tab_spec.lua
+++ b/test/functional/terminal/window_split_tab_spec.lua
@@ -3,6 +3,9 @@ local thelpers = require('test.functional.terminal.helpers')
local clear = helpers.clear
local feed, nvim = helpers.feed, helpers.nvim
local feed_command = helpers.feed_command
+local command = helpers.command
+local eq = helpers.eq
+local eval = helpers.eval
describe('terminal', function()
local screen
@@ -22,72 +25,66 @@ describe('terminal', function()
screen:detach()
end)
- it('resets its size when entering terminal window', function()
+ it('next to a closing window', function()
+ command('split')
+ command('terminal')
+ command('vsplit foo')
+ eq(3, eval("winnr('$')"))
+ feed('ZQ') -- Close split, should not crash. #7538
+ eq(2, eval("1+1")) -- Still alive?
+ end)
+
+ it('does not change size on WinEnter', function()
if helpers.pending_win32(pending) then return end
feed('<c-\\><c-n>')
feed_command('2split')
screen:expect([[
- rows: 2, cols: 50 |
- {2:^ } |
- ========== |
- rows: 2, cols: 50 |
- {2: } |
- {4:~ }|
- {4:~ }|
- {4:~ }|
- ========== |
- :2split |
- ]])
- feed_command('wincmd p')
- screen:expect([[
tty ready |
- rows: 2, cols: 50 |
+ ^rows: 5, cols: 50 |
========== |
tty ready |
- rows: 2, cols: 50 |
rows: 5, cols: 50 |
{2: } |
- ^ |
+ |
+ |
========== |
- :wincmd p |
+ :2split |
]])
feed_command('wincmd p')
screen:expect([[
- rows: 2, cols: 50 |
- {2:^ } |
+ tty ready |
+ rows: 5, cols: 50 |
========== |
- rows: 2, cols: 50 |
+ tty ready |
+ ^rows: 5, cols: 50 |
{2: } |
- {4:~ }|
- {4:~ }|
- {4:~ }|
+ |
+ |
========== |
:wincmd p |
]])
end)
- describe('when the screen is resized', function()
- it('will forward a resize request to the program', function()
- feed([[<C-\><C-N>:]]) -- Go to cmdline-mode, so cursor is at bottom.
- screen:try_resize(screen._width - 3, screen._height - 2)
- screen:expect([[
- tty ready |
- rows: 7, cols: 47 |
- {2: } |
- |
- |
- |
- |
- :^ |
- ]])
- screen:try_resize(screen._width - 6, screen._height - 3)
- screen:expect([[
- tty ready |
- rows: 7, cols: 47 |
- rows: 4, cols: 41 |
- {2: } |
- :^ |
- ]])
- end)
+ it('forwards resize request to the program', function()
+ feed([[<C-\><C-N>:]]) -- Go to cmdline-mode, so cursor is at bottom.
+ screen:try_resize(screen._width - 3, screen._height - 2)
+ screen:expect([[
+ tty ready |
+ rows: 7, cols: 47 |
+ {2: } |
+ |
+ |
+ |
+ |
+ :^ |
+ ]])
+ screen:try_resize(screen._width - 6, screen._height - 3)
+ screen:expect([[
+ tty ready |
+ rows: 7, cols: 47 |
+ rows: 4, cols: 41 |
+ {2: } |
+ :^ |
+ ]])
end)
end)
diff --git a/test/unit/path_spec.lua b/test/unit/path_spec.lua
index befb204d0a..ed597eaed7 100644
--- a/test/unit/path_spec.lua
+++ b/test/unit/path_spec.lua
@@ -366,134 +366,156 @@ describe('path.c', function()
end)
describe('vim_FullName', function()
- local function vim_FullName(filename, buf, len, force)
- filename = to_cstr(filename)
- return cimp.vim_FullName(filename, buf, len, force)
+ local function vim_FullName(filename, buflen, do_expand)
+ local buf = cstr(buflen, '')
+ local result = cimp.vim_FullName(to_cstr(filename), buf, buflen, do_expand)
+ return buf, result
end
- before_each(function()
- -- Create empty string buffer which will contain the resulting path.
- length = (string.len(lfs.currentdir())) + 33
- buffer = cstr(length, '')
- end)
+ local function get_buf_len(s, t)
+ return math.max(string.len(s), string.len(t)) + 1
+ end
itp('fails if given filename is NULL', function()
- local force_expansion = 1
- local result = cimp.vim_FullName(NULL, buffer, length, force_expansion)
+ local do_expand = 1
+ local buflen = 10
+ local buf = cstr(buflen, '')
+ local result = cimp.vim_FullName(NULL, buf, buflen, do_expand)
eq(FAIL, result)
end)
itp('fails safely if given length is wrong #5737', function()
- local force_expansion = 1
local filename = 'foo/bar/bazzzzzzz/buz/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/a'
local too_short_len = 8
local buf = cstr(too_short_len, '')
- local result = cimp.vim_FullName(filename, buf, too_short_len, force_expansion)
+ local do_expand = 1
+ local result = cimp.vim_FullName(filename, buf, too_short_len, do_expand)
local expected = string.sub(filename, 1, (too_short_len - 1))
- eq(expected, (ffi.string(buf)))
+ eq(expected, ffi.string(buf))
eq(FAIL, result)
end)
itp('uses the filename if the filename is a URL', function()
- local force_expansion = 1
local filename = 'http://www.neovim.org'
- local result = vim_FullName(filename, buffer, length, force_expansion)
- eq(filename, (ffi.string(buffer)))
+ local buflen = string.len(filename) + 1
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(filename, ffi.string(buf))
eq(OK, result)
end)
itp('fails and uses filename if given filename contains non-existing directory', function()
- local force_expansion = 1
local filename = 'non_existing_dir/test.file'
- local result = vim_FullName(filename, buffer, length, force_expansion)
- eq(filename, (ffi.string(buffer)))
+ local buflen = string.len(filename) + 1
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(filename, ffi.string(buf))
eq(FAIL, result)
end)
itp('concatenates filename if it does not contain a slash', function()
- local force_expansion = 1
- local result = vim_FullName('test.file', buffer, length, force_expansion)
local expected = lfs.currentdir() .. '/test.file'
- eq(expected, (ffi.string(buffer)))
+ local filename = 'test.file'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(expected, ffi.string(buf))
eq(OK, result)
end)
itp('concatenates directory name if it does not contain a slash', function()
- local force_expansion = 1
- local result = vim_FullName('..', buffer, length, force_expansion)
local expected = lfs.currentdir() .. '/..'
- eq(expected, (ffi.string(buffer)))
+ local filename = '..'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(expected, ffi.string(buf))
eq(OK, result)
end)
- -- Is it possible for every developer to enter '..' directory while running
- -- the unit tests? Which other directory would be better?
itp('enters given directory (instead of just concatenating the strings) if possible and if path contains a slash', function()
- local force_expansion = 1
- local result = vim_FullName('../test.file', buffer, length, force_expansion)
local old_dir = lfs.currentdir()
lfs.chdir('..')
local expected = lfs.currentdir() .. '/test.file'
lfs.chdir(old_dir)
- eq(expected, (ffi.string(buffer)))
+ local filename = '../test.file'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(expected, ffi.string(buf))
eq(OK, result)
end)
itp('just copies the path if it is already absolute and force=0', function()
- local force_expansion = 0
local absolute_path = '/absolute/path'
- local result = vim_FullName(absolute_path, buffer, length, force_expansion)
- eq(absolute_path, (ffi.string(buffer)))
+ local buflen = string.len(absolute_path) + 1
+ local do_expand = 0
+ local buf, result = vim_FullName(absolute_path, buflen, do_expand)
+ eq(absolute_path, ffi.string(buf))
eq(OK, result)
end)
itp('fails and uses filename when the path is relative to HOME', function()
eq(false, cimp.os_isdir('~')) -- sanity check: no literal "~" directory.
- local force_expansion = 1
local absolute_path = '~/home.file'
- local result = vim_FullName(absolute_path, buffer, length, force_expansion)
- eq(absolute_path, (ffi.string(buffer)))
+ local buflen = string.len(absolute_path) + 1
+ local do_expand = 1
+ local buf, result = vim_FullName(absolute_path, buflen, do_expand)
+ eq(absolute_path, ffi.string(buf))
eq(FAIL, result)
end)
itp('works with some "normal" relative path with directories', function()
- local force_expansion = 1
- local result = vim_FullName('unit-test-directory/test.file', buffer, length, force_expansion)
+ local expected = lfs.currentdir() .. '/unit-test-directory/test.file'
+ local filename = 'unit-test-directory/test.file'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq(expected, ffi.string(buf))
eq(OK, result)
- eq(lfs.currentdir() .. '/unit-test-directory/test.file', (ffi.string(buffer)))
end)
itp('does not modify the given filename', function()
- local force_expansion = 1
+ local expected = lfs.currentdir() .. '/unit-test-directory/test.file'
local filename = to_cstr('unit-test-directory/test.file')
- -- Don't use the wrapper here but pass a cstring directly to the c
- -- function.
- local result = cimp.vim_FullName(filename, buffer, length, force_expansion)
- eq(lfs.currentdir() .. '/unit-test-directory/test.file', (ffi.string(buffer)))
- eq('unit-test-directory/test.file', (ffi.string(filename)))
+ local buflen = string.len(expected) + 1
+ local buf = cstr(buflen, '')
+ local do_expand = 1
+ -- Don't use the wrapper but pass a cstring directly to the c function.
+ eq('unit-test-directory/test.file', ffi.string(filename))
+ local result = cimp.vim_FullName(filename, buf, buflen, do_expand)
+ eq(expected, ffi.string(buf))
eq(OK, result)
end)
itp('works with directories that have one path component', function()
- local force_expansion = 1
- local filename = to_cstr('/tmp')
- local result = cimp.vim_FullName(filename, buffer, length, force_expansion)
- eq('/tmp', ffi.string(buffer))
+ local filename = '/tmp'
+ local expected = filename
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
+ eq('/tmp', ffi.string(buf))
eq(OK, result)
end)
itp('expands "./" to the current directory #7117', function()
- local force_expansion = 1
- local result = vim_FullName('./unit-test-directory/test.file', buffer, length, force_expansion)
+ local expected = lfs.currentdir() .. '/unit-test-directory/test.file'
+ local filename = './unit-test-directory/test.file'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
eq(OK, result)
- eq(lfs.currentdir() .. '/unit-test-directory/test.file', (ffi.string(buffer)))
+ eq(expected, ffi.string(buf))
end)
itp('collapses "foo/../foo" to "foo" #7117', function()
- local force_expansion = 1
- local result = vim_FullName('unit-test-directory/../unit-test-directory/test.file', buffer, length, force_expansion)
+ local expected = lfs.currentdir() .. '/unit-test-directory/test.file'
+ local filename = 'unit-test-directory/../unit-test-directory/test.file'
+ local buflen = get_buf_len(expected, filename)
+ local do_expand = 1
+ local buf, result = vim_FullName(filename, buflen, do_expand)
eq(OK, result)
- eq(lfs.currentdir() .. '/unit-test-directory/test.file', (ffi.string(buffer)))
+ eq(expected, ffi.string(buf))
end)
end)