test_javac_handler.vader
1 Before: 2 runtime ale_linters/java/javac.vim 3 4 call ale#test#SetDirectory('/testplugin/test') 5 call ale#test#SetFilename('dummy.java') 6 7 After: 8 call ale#test#RestoreDirectory() 9 call ale#linter#Reset() 10 11 Execute(The javac handler should handle cannot find symbol errors): 12 AssertEqual 13 \ [ 14 \ { 15 \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), 16 \ 'lnum': 1, 17 \ 'text': 'error: some error', 18 \ 'type': 'E', 19 \ }, 20 \ { 21 \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), 22 \ 'lnum': 2, 23 \ 'col': 5, 24 \ 'text': 'error: cannot find symbol: BadName', 25 \ 'type': 'E', 26 \ }, 27 \ { 28 \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), 29 \ 'lnum': 34, 30 \ 'col': 5, 31 \ 'text': 'error: cannot find symbol: BadName2', 32 \ 'type': 'E', 33 \ }, 34 \ { 35 \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), 36 \ 'lnum': 37, 37 \ 'text': 'warning: some warning', 38 \ 'type': 'W', 39 \ }, 40 \ { 41 \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), 42 \ 'lnum': 42, 43 \ 'col': 11, 44 \ 'text': 'error: cannot find symbol: bar()', 45 \ 'type': 'E', 46 \ }, 47 \ { 48 \ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'), 49 \ 'lnum': 58, 50 \ 'col': 19, 51 \ 'text': 'error: incompatible types: Bar cannot be converted to Foo', 52 \ 'type': 'E', 53 \ }, 54 \ ], 55 \ ale_linters#java#javac#Handle(bufnr(''), [ 56 \ '/tmp/vLPr4Q5/33/foo.java:1: error: some error', 57 \ '/tmp/vLPr4Q5/33/foo.java:2: error: cannot find symbol', 58 \ ' BadName foo() {', 59 \ ' ^', 60 \ ' symbol: class BadName', 61 \ ' location: class Bar', 62 \ '/tmp/vLPr4Q5/33/foo.java:34: error: cannot find symbol', 63 \ ' BadName2 foo() {', 64 \ ' ^', 65 \ ' symbol: class BadName2', 66 \ ' location: class Bar', 67 \ '/tmp/vLPr4Q5/33/foo.java:37: warning: some warning', 68 \ '/tmp/vLPr4Q5/33/foo.java:42: error: cannot find symbol', 69 \ ' this.bar();', 70 \ ' ^', 71 \ ' symbol: method bar()', 72 \ '/tmp/vLPr4Q5/33/foo.java:58: error: incompatible types: Bar cannot be converted to Foo', 73 \ ' this.setFoo(bar);', 74 \ ' ^', 75 \ '6 errors', 76 \ ]) 77 78 Execute(The javac handler should resolve files from different directories): 79 AssertEqual 80 \ [ 81 \ { 82 \ 'filename': ale#path#Simplify(g:dir . '/Foo.java'), 83 \ 'lnum': 1, 84 \ 'text': 'error: some error', 85 \ 'type': 'E', 86 \ }, 87 \ { 88 \ 'filename': ale#path#Simplify(g:dir . '/Bar.java'), 89 \ 'lnum': 1, 90 \ 'text': 'error: some error', 91 \ 'type': 'E', 92 \ }, 93 \ ], 94 \ ale_linters#java#javac#Handle(bufnr(''), [ 95 \ './Foo.java:1: error: some error', 96 \ './Bar.java:1: error: some error', 97 \ ])