diff options
author | w0rp <devw0rp@gmail.com> | 2017-07-11 23:47:13 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-07-11 23:47:21 +0100 |
commit | 340c0bbac53df00c2d0c00d3e626776c4a6016bf (patch) | |
tree | 566b7230e948f7a3a0bb646ec52fab5e3c98103f /test | |
parent | d12e990f73156506fecfe7bb229dff8b8d57ee4a (diff) | |
download | ale-340c0bbac53df00c2d0c00d3e626776c4a6016bf.zip |
#756 Escape the paths used for the --include parameter for gometalinter, which uses RE2
Diffstat (limited to 'test')
-rw-r--r-- | test/command_callback/test_gometalinter_command_callback.vader | 6 | ||||
-rw-r--r-- | test/test_regex_escaping.vader | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/test/command_callback/test_gometalinter_command_callback.vader b/test/command_callback/test_gometalinter_command_callback.vader index f1b4e9f0..a0f4da4f 100644 --- a/test/command_callback/test_gometalinter_command_callback.vader +++ b/test/command_callback/test_gometalinter_command_callback.vader @@ -22,7 +22,7 @@ Execute(The gometalinter callback should return the right defaults): \ ale_linters#go#gometalinter#GetExecutable(bufnr('')) AssertEqual \ ale#Escape('gometalinter') - \ . ' --include=' . ale#Escape(expand('%')) + \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%'))) \ . ' ' . ale#Escape(getcwd()), \ ale_linters#go#gometalinter#GetCommand(bufnr('')) @@ -34,7 +34,7 @@ Execute(The gometalinter callback should use a configured executable): \ ale_linters#go#gometalinter#GetExecutable(bufnr('')) AssertEqual \ ale#Escape('something else') - \ . ' --include=' . ale#Escape(expand('%')) + \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%'))) \ . ' ' . ale#Escape(getcwd()), \ ale_linters#go#gometalinter#GetCommand(bufnr('')) @@ -43,7 +43,7 @@ Execute(The gometalinter callback should use configured options): AssertEqual \ ale#Escape('gometalinter') - \ . ' --include=' . ale#Escape(expand('%')) + \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%'))) \ . ' --foobar' \ . ' ' . ale#Escape(getcwd()), \ ale_linters#go#gometalinter#GetCommand(bufnr('')) diff --git a/test/test_regex_escaping.vader b/test/test_regex_escaping.vader new file mode 100644 index 00000000..b79b8c56 --- /dev/null +++ b/test/test_regex_escaping.vader @@ -0,0 +1,4 @@ +Execute(ale#util#EscapePCRE should escape strings for PCRE or RE2 appropriately): + AssertEqual '\\\^\$\*\+\?\.\(\)\|\{\}\[\]', ale#util#EscapePCRE('\^$*+?.()|{}[]') + AssertEqual 'abcABC09', ale#util#EscapePCRE('abcABC09') + AssertEqual '/', ale#util#EscapePCRE('/') |