Skip to content

Commit e739a2e

Browse files
authored
fix(test_harness): resolved invalid escape sequence error caused by Windows backslash in filepaths. (#519)
1 parent a56bf00 commit e739a2e

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

lua/plenary/busted.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ clear = mod.clear
215215
assert = require "luassert"
216216

217217
mod.run = function(file)
218+
file = file:gsub("\\", "/")
219+
218220
print("\n" .. HEADER)
219221
print("Testing: ", file)
220222

lua/plenary/test_harness.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ end
4242

4343
function harness.test_directory(directory, opts)
4444
print "Starting..."
45+
directory = directory:gsub("\\", "/")
4546
local minimal = not opts or not opts.init or opts.minimal or opts.minimal_init
4647

4748
opts = vim.tbl_deep_extend("force", {

plugin/plenary.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

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

66
command! -nargs=+ -complete=file PlenaryBustedDirectory
7-
\ lua require('plenary.test_harness').test_directory_command("<args>")
7+
\ lua require('plenary.test_harness').test_directory_command([[<args>]])
88

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

0 commit comments

Comments
 (0)