1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
From 0c932626b0e6829a8380d39f1cc8f936159e5e5d Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Mon, 21 May 2018 19:14:12 +0200
Subject: [PATCH] Fix cli caching spec to not fail when PWD contains hyphen
When the current working directory (returned by `fs.get_current_dir()`)
contains a hyphen (e.g. /home/flynn/luacheck-0.22.0), the spec
"cli caching caches results" fails, because "-" is interpreted as
pattern item.
This commit fixes this problem by escaping "-" together with "[" and
"]" inside the template after abspath{...} is substituted.
Upstream-Issue: https://github.com/mpeterv/luacheck/pull/164
---
spec/cli_spec.lua | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/spec/cli_spec.lua b/spec/cli_spec.lua
index 35365dc..4749b79 100644
--- a/spec/cli_spec.lua
+++ b/spec/cli_spec.lua
@@ -913,7 +913,7 @@ Total: 16 warnings / 1 error in 4 files
end
-- luacheck: push no max string line length
- local format_version, good_mtime, bad_mtime, python_mtime = cache:match(replace_abspath(([[
+ local format_version, good_mtime, bad_mtime, python_mtime = cache:match(replace_abspath([[
(%d+)
abspath{spec/samples/good_code.lua}
@@ -925,7 +925,7 @@ local A,B,C,D,E,F="package","561","helper","function","embrace","hepler";return
abspath{spec/samples/python_code.lua}
(%d+)
return {{{"011",[3]=1,[4]=6,[5]=15,[13]="expected '=' near '__future__'"}},{},{},{}}
-]]):gsub("[%[%]]", "%%%0")))
+]]):gsub("[%[%]%-]", "%%%0"), nil)
-- luacheck: pop
format_version = tonumber(format_version)
|