summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-05 15:33:31 +0000
committerw0rp <devw0rp@gmail.com>2017-11-05 15:33:31 +0000
commit34674e088d7d990d21a4cee5e289200cee5f9d6c (patch)
treeb7a2625e08b20699b554a7ae160b1bdc67fede8d /test/handler
parentd851f399c054d487232294d9f1c3a6974215f4a8 (diff)
downloadale-34674e088d7d990d21a4cee5e289200cee5f9d6c.zip
Fix #1061 - Handle the filenames returned by javac
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_javac_handler.vader34
1 files changed, 32 insertions, 2 deletions
diff --git a/test/handler/test_javac_handler.vader b/test/handler/test_javac_handler.vader
index 2cf32072..3997b42c 100644
--- a/test/handler/test_javac_handler.vader
+++ b/test/handler/test_javac_handler.vader
@@ -1,42 +1,51 @@
Before:
runtime ale_linters/java/javac.vim
+ call ale#test#SetDirectory('/testplugin/test')
+ call ale#test#SetFilename('dummy.java')
+
After:
+ call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The javac handler should handle cannot find symbol errors):
AssertEqual
\ [
\ {
+ \ 'filename': '/tmp/vLPr4Q5/33/foo.java',
\ 'lnum': 1,
\ 'text': 'error: some error',
\ 'type': 'E',
\ },
\ {
+ \ 'filename': '/tmp/vLPr4Q5/33/foo.java',
\ 'lnum': 2,
\ 'col': 5,
\ 'text': 'error: cannot find symbol: BadName',
\ 'type': 'E',
\ },
\ {
+ \ 'filename': '/tmp/vLPr4Q5/33/foo.java',
\ 'lnum': 34,
\ 'col': 5,
\ 'text': 'error: cannot find symbol: BadName2',
\ 'type': 'E',
\ },
\ {
+ \ 'filename': '/tmp/vLPr4Q5/33/foo.java',
\ 'lnum': 37,
\ 'text': 'warning: some warning',
\ 'type': 'W',
\ },
\ {
+ \ 'filename': '/tmp/vLPr4Q5/33/foo.java',
\ 'lnum': 42,
\ 'col': 11,
\ 'text': 'error: cannot find symbol: bar()',
\ 'type': 'E',
\ },
\ ],
- \ ale_linters#java#javac#Handle(347, [
+ \ ale_linters#java#javac#Handle(bufnr(''), [
\ '/tmp/vLPr4Q5/33/foo.java:1: error: some error',
\ '/tmp/vLPr4Q5/33/foo.java:2: error: cannot find symbol',
\ ' BadName foo() {',
@@ -49,9 +58,30 @@ Execute(The javac handler should handle cannot find symbol errors):
\ ' symbol: class BadName2',
\ ' location: class Bar',
\ '/tmp/vLPr4Q5/33/foo.java:37: warning: some warning',
- \ '/tmp/vLPr4Q5/264/foo.java:42: error: cannot find symbol',
+ \ '/tmp/vLPr4Q5/33/foo.java:42: error: cannot find symbol',
\ ' this.bar();',
\ ' ^',
\ ' symbol: method bar()',
\ '5 errors',
\ ])
+
+Execute(The javac handler should resolve files from different directories):
+ AssertEqual
+ \ [
+ \ {
+ \ 'filename': ale#path#Winify(g:dir . '/Foo.java'),
+ \ 'lnum': 1,
+ \ 'text': 'error: some error',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'filename': ale#path#Winify(g:dir . '/Bar.java'),
+ \ 'lnum': 1,
+ \ 'text': 'error: some error',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#java#javac#Handle(bufnr(''), [
+ \ './Foo.java:1: error: some error',
+ \ './Bar.java:1: error: some error',
+ \ ])