Skip to content

Commit

Permalink
fix: PlenaryBustedDirectory command (#455)
Browse files Browse the repository at this point in the history
expand() should only be called for the first argument, not for the
second one.
The second argument is a string representation of a Lua option table
which did work in case of a single entry, where only the braces were
removed.
For multiple entries Lua was not able to parse the expanded version as
option table anymore, though.
  • Loading branch information
ThomasFeher committed Feb 19, 2023
1 parent 51351fd commit 253d348
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lua/plenary/test_harness.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end

function harness.test_directory_command(command)
local split_string = vim.split(command, " ")
local directory = table.remove(split_string, 1)
local directory = vim.fn.expand(table.remove(split_string, 1))

local opts = assert(loadstring("return " .. table.concat(split_string, " ")))()

Expand Down
2 changes: 1 addition & 1 deletion plugin/plenary.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ command! -nargs=1 -complete=file PlenaryBustedFile
\ lua require('plenary.busted').run(vim.fn.expand("<args>"))

command! -nargs=+ -complete=file PlenaryBustedDirectory
\ lua require('plenary.test_harness').test_directory_command(vim.fn.expand("<args>"))
\ lua require('plenary.test_harness').test_directory_command("<args>")

nnoremap <Plug>PlenaryTestFile :lua require('plenary.test_harness').test_directory(vim.fn.expand("%:p"))<CR>

0 comments on commit 253d348

Please sign in to comment.