summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-29 17:33:18 +0100
committerw0rp <devw0rp@gmail.com>2017-04-29 17:33:18 +0100
commit0b4acd645395d4196f2e346d65aeddf063927f4e (patch)
tree2701b1faefec6e1cc2dbfd5775d3bf94c6a5e022 /test
parentcbb01e32b950f4a5c14d56b41759945662b2db49 (diff)
downloadale-0b4acd645395d4196f2e346d65aeddf063927f4e.zip
Fix #518 Fix handling of spaces in filenames for various linters
Diffstat (limited to 'test')
-rw-r--r--test/handler/test_common_handlers.vader28
-rw-r--r--test/handler/test_gobuild_handler.vader44
-rw-r--r--test/handler/test_gometalinter_handler.vader53
-rw-r--r--test/handler/test_mypy_handler.vader21
4 files changed, 143 insertions, 3 deletions
diff --git a/test/handler/test_common_handlers.vader b/test/handler/test_common_handlers.vader
index 21a6f6a0..a9fc9149 100644
--- a/test/handler/test_common_handlers.vader
+++ b/test/handler/test_common_handlers.vader
@@ -40,6 +40,20 @@ Execute (HandlePEP8Format should handle the correct lines of output):
\ "test.yml:35: [EANSIBLE0002] Trailing whitespace",
\ ])
+Execute (HandlePEP8Format should handle names with spaces):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 6,
+ \ 'col': 6,
+ \ 'type': 'E',
+ \ 'text': 'E111: indentation is not a multiple of four',
+ \ },
+ \ ],
+ \ ale#handlers#python#HandlePEP8Format(42, [
+ \ 'C:\something\with spaces.py:6:6: E111 indentation is not a multiple of four',
+ \ ])
+
Execute (HandleGCCFormat should handle the correct lines of output):
AssertEqual
\ [
@@ -122,6 +136,20 @@ Execute (HandleUnixFormatAsError should handle lines with no space after the col
\ 'some_file.xyz:53:10:bar',
\ ])
+Execute (HandleUnixFormatAsError should handle names with spaces):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 13,
+ \ 'col': 90,
+ \ 'type': 'E',
+ \ 'text': 'leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.',
+ \ },
+ \ ],
+ \ ale#handlers#unix#HandleAsError(42, [
+ \ '/Users/rrj/Notes/Astro/Taurus December SM.txt:13:90: leonard.exclamation.30ppm More than 30 ppm of exclamations. Keep them under control.',
+ \ ])
+
Execute (HandleUnixFormatAsWarning should handle some example lines of output):
AssertEqual
\ [
diff --git a/test/handler/test_gobuild_handler.vader b/test/handler/test_gobuild_handler.vader
new file mode 100644
index 00000000..7748dcc7
--- /dev/null
+++ b/test/handler/test_gobuild_handler.vader
@@ -0,0 +1,44 @@
+Before:
+ runtime ale_linters/go/gobuild.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute (The gobuild handler should handle names with spaces):
+ " We can't test Windows paths with the path resovling on Linux, but we can
+ " test the regex.
+ AssertEqual
+ \ [
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '27',
+ \ '',
+ \ 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
+ \ ],
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '5',
+ \ '2',
+ \ 'expected declaration, found ''STRING'' "log"',
+ \ ],
+ \ ],
+ \ map(ale_linters#go#gobuild#GetMatches([
+ \ 'C:\something\file with spaces.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
+ \ 'C:\something\file with spaces.go:5:2: expected declaration, found ''STRING'' "log"',
+ \ ]), 'v:val[1:4]')
+
+Execute (The gobuild handler should handle relative paths correctly):
+ :file! /foo/bar/baz.go
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 27,
+ \ 'col': 0,
+ \ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#go#gobuild#Handler(42, [
+ \ 'baz.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
+ \ ])
diff --git a/test/handler/test_gometalinter_handler.vader b/test/handler/test_gometalinter_handler.vader
new file mode 100644
index 00000000..3b622130
--- /dev/null
+++ b/test/handler/test_gometalinter_handler.vader
@@ -0,0 +1,53 @@
+Before:
+ runtime ale_linters/go/gometalinter.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute (The gometalinter handler should handle names with spaces):
+ " We can't test Windows paths with the path resovling on Linux, but we can
+ " test the regex.
+ AssertEqual
+ \ [
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '12',
+ \ '3',
+ \ 'warning',
+ \ 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ ],
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '37',
+ \ '5',
+ \ 'error',
+ \ 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ],
+ \ ],
+ \ map(ale_linters#go#gometalinter#GetMatches([
+ \ 'C:\something\file with spaces.go:12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'C:\something\file with spaces.go:37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ]), 'v:val[1:5]')
+
+Execute (The gometalinter handler should handle relative paths correctly):
+ :file! /foo/bar/baz.go
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 12,
+ \ 'col': 3,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 37,
+ \ 'col': 5,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#go#gometalinter#Handler(42, [
+ \ 'baz.go:12:3:warning: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'baz.go:37:5:error: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ])
diff --git a/test/handler/test_mypy_handler.vader b/test/handler/test_mypy_handler.vader
index 77e678e4..e1b1562d 100644
--- a/test/handler/test_mypy_handler.vader
+++ b/test/handler/test_mypy_handler.vader
@@ -1,6 +1,10 @@
-Execute(The mypy handler should parse lines correctly):
+Before:
runtime ale_linters/python/mypy.vim
+After:
+ call ale#linter#Reset()
+
+Execute(The mypy handler should parse lines correctly):
AssertEqual
\ [
\ {
@@ -22,5 +26,16 @@ Execute(The mypy handler should parse lines correctly):
\ "file.py:40:5: error: Some other problem",
\ ])
-After:
- call ale#linter#Reset()
+Execute(The mypy handler should handle Windows names with spaces):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 4,
+ \ 'col': 0,
+ \ 'text': "No library stub file for module 'django.db'",
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#python#mypy#Handle(347, [
+ \ "C:\something\with spaces.py:4: error: No library stub file for module 'django.db'",
+ \ ])