Skip to content

Commit

Permalink
fix(test_harness): resolved invalid escape sequence error caused by W…
Browse files Browse the repository at this point in the history
…indows backslash in filepaths. (nvim-lua#519)
  • Loading branch information
linguini1 authored Sep 10, 2023
1 parent a56bf00 commit e739a2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lua/plenary/busted.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ clear = mod.clear
assert = require "luassert"

mod.run = function(file)
file = file:gsub("\\", "/")

print("\n" .. HEADER)
print("Testing: ", file)

Expand Down
1 change: 1 addition & 0 deletions lua/plenary/test_harness.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ end

function harness.test_directory(directory, opts)
print "Starting..."
directory = directory:gsub("\\", "/")
local minimal = not opts or not opts.init or opts.minimal or opts.minimal_init

opts = vim.tbl_deep_extend("force", {
Expand Down
4 changes: 2 additions & 2 deletions plugin/plenary.vim
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

" Create command for running busted
command! -nargs=1 -complete=file PlenaryBustedFile
\ lua require('plenary.busted').run(vim.fn.expand("<args>"))
\ lua require('plenary.busted').run(vim.fn.expand([[<args>]]))

command! -nargs=+ -complete=file PlenaryBustedDirectory
\ lua require('plenary.test_harness').test_directory_command("<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 e739a2e

Please sign in to comment.