Skip to content

Conversation

mhinz
Copy link
Member

@mhinz mhinz commented Nov 8, 2017

Fixed-size buffers and lfs.currentdir().. does not compute. The tests would fail
if the current working directory was longer than expected.


local function vim_FullName(path, buflen)
buf = cstr(buflen, '')
return cimp.vim_FullName(to_cstr(path), buf, buflen, do_expand)
Copy link
Member

@justinmk justinmk Nov 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lua has multi-return, so this could return buf, cimp.vim_..., then buf could stay local. And do_expand should just be a parameter (as it already was. Not in favor of shared-state to save a couple lines of code; tests especially should lean towards "explicit, self-contained" more than "DRY").

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 path = 'foo/bar/bazzzzzzz/buz/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/a'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally avoid naming variables "path" (usually) since (1) it often means $PATH and (2) "filename" tends to be more common in most APIs I've seen. Sometimes filepath is ok in contexts where "filename" means only the tail.

@mhinz mhinz force-pushed the test/unit/path_spec branch from 6b0515f to e628da2 Compare November 9, 2017 01:05
Fixed-size buffers and lfs.currentdir().. does not compute. The tests would fail
if the current working directory was longer than expected.
@mhinz mhinz force-pushed the test/unit/path_spec branch from e628da2 to 6e4aa62 Compare November 9, 2017 10:58
@justinmk justinmk merged commit d5b7f28 into neovim:master Nov 13, 2017
sameedali added a commit to sameedali/neovim that referenced this pull request Nov 19, 2017
* 'master' of https://github.com/neovim/neovim: (148 commits)
  vim-patch:8.0.0283
  version bump
  NVIM v0.2.2
  tui: setrgbf/setrgbb: emit semicolons for VTE
  'viewoptions': add "curdir" flag neovim#7447
  win: provider: Detect(): return *.cmd path (neovim#7577)
  os_nodetype: rework
  os_open, os_stat: UV_EINVAL on NULL filename
  tui: 'guicursor': use DECSCUSR for xterm-likes (neovim#7576)
  lint neovim#7562
  :checkhealth: fix check for npm and yarn (neovim#7569)
  doc: Fix pathshorten() example (neovim#7571)
  health.vim: define highlights as `default` (neovim#7560)
  runtime: revert netrw update (neovim#7557)
  defaults: scrollback=10000 (neovim#7556)
  doc: test/README.md: migrate wiki info (neovim#7552)
  vim-patch:8.0.0227 (neovim#7548)
  test/unit/path_spec: expect correct buffer size (neovim#7514)
  health.vim: normalize slashes for script path (neovim#7525)
  :terminal : fix crash on resize (neovim#7547)
  ...
@mhinz mhinz deleted the test/unit/path_spec branch November 23, 2017 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants