test_csc_handler.vader
1 Before: 2 Save g:ale_cs_csc_source 3 4 unlet! g:ale_cs_csc_source 5 6 call ale#test#SetDirectory('/testplugin/test/handler') 7 call ale#test#SetFilename('Test.cs') 8 9 runtime ale_linters/cs/csc.vim 10 11 After: 12 Restore 13 14 call ale#test#RestoreDirectory() 15 call ale#linter#Reset() 16 17 Execute(The csc handler should work with the default of the buffer's directory): 18 AssertEqual 19 \ [ 20 \ { 21 \ 'lnum': 12, 22 \ 'col' : 29, 23 \ 'text': '; expected', 24 \ 'code': 'CS1001', 25 \ 'type': 'E', 26 \ 'filename': ale#path#Simplify(g:dir . '/Test.cs'), 27 \ }, 28 \ ], 29 \ ale_linters#cs#csc#Handle(bufnr(''), [ 30 \ 'Test.cs(12,29): error CS1001: ; expected', 31 \ 'Compilation failed: 2 error(s), 1 warnings', 32 \ ]) 33 34 Execute(The csc handler should handle cannot find symbol errors): 35 let g:ale_cs_csc_source = '/home/foo/project/bar' 36 37 AssertEqual 38 \ [ 39 \ { 40 \ 'lnum': 12, 41 \ 'col' : 29, 42 \ 'text': '; expected', 43 \ 'code': 'CS1001', 44 \ 'type': 'E', 45 \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), 46 \ }, 47 \ { 48 \ 'lnum': 101, 49 \ 'col': 0, 50 \ 'text': 'Unexpected processor directive (no #if for this #endif)', 51 \ 'code': 'CS1028', 52 \ 'type': 'E', 53 \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), 54 \ }, 55 \ { 56 \ 'lnum': 10, 57 \ 'col': 12, 58 \ 'text': 'some warning', 59 \ 'code': 'CS0123', 60 \ 'type': 'W', 61 \ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'), 62 \ }, 63 \ ], 64 \ ale_linters#cs#csc#Handle(bufnr(''), [ 65 \ 'Test.cs(12,29): error CS1001: ; expected', 66 \ 'Test.cs(101,0): error CS1028: Unexpected processor directive (no #if for this #endif)', 67 \ 'Test.cs(10,12): warning CS0123: some warning', 68 \ 'Compilation failed: 2 error(s), 1 warnings', 69 \ ]) 70 71 Execute(The csc handler should handle non file specific compiler errors without reporting overal status report as error): 72 let g:ale_cs_csc_source = '/home/foo/project/bar' 73 74 AssertEqual 75 \ [ 76 \ { 77 \ 'lnum': -1, 78 \ 'col' : -1, 79 \ 'text': 'No source files specified.', 80 \ 'code': 'CS2008', 81 \ 'type': 'W', 82 \ 'filename': '<csc>', 83 \ }, 84 \ { 85 \ 'lnum': -1, 86 \ 'col': -1, 87 \ 'text': 'Outputs without source must have the /out option specified', 88 \ 'code': 'CS1562', 89 \ 'type': 'E', 90 \ 'filename': '<csc>', 91 \ }, 92 \ ], 93 \ ale_linters#cs#csc#Handle(bufnr(''), [ 94 \ 'Microsoft (R) Visual C# Compiler version 2.8.2.62916 (2ad4aabc)', 95 \ 'Copyright (C) Microsoft Corporation. All rights reserved.', 96 \ 'warning CS2008: No source files specified.', 97 \ 'error CS1562: Outputs without source must have the /out option specified', 98 \ ])