/ test / handler / test_openscad_handler.vader
test_openscad_handler.vader
 1  Before:
 2    call ale#test#SetDirectory('/testplugin/test/handler')
 3  
 4    " Load sca2d
 5    runtime ale_linters/openscad/sca2d.vim
 6  
 7  After:
 8    call ale#test#RestoreDirectory()
 9    call ale#linter#Reset()
10  
11  Execute(The openscad handler should handle sca2d output):
12    AssertEqual
13    \ [
14    \   {
15    \     'filename': ale#path#Simplify(g:dir . '/awesome_project.scad'),
16    \     'lnum': 7,
17    \     'type': 'E',
18    \     'col': 42,
19    \     'text': 'Module `corcle` used but never defined.',
20    \     'detail': 'E2002: Module `corcle` used but never defined.',
21    \   },
22    \ ],
23    \ ale#handlers#openscad#SCA2D_callback(bufnr(''), [
24    \  'awesome_project.scad:7:42: E2002: Module `corcle` used but never defined.',
25    \   '',
26    \   'SCA2D message summary',
27    \   '=====================',
28    \   'Fatal errors: 0',
29    \   'Errors:       1',
30    \   'Warnings:     0',
31    \   'Info:         0',
32    \   'Depreciated   0',
33    \ ])
34  
35    AssertEqual
36    \ [
37    \   {
38    \     'filename': ale#path#Simplify(g:dir . '/awesome_project.scad'),
39    \     'lnum': 1,
40    \     'type': 'E',
41    \     'col': 37,
42    \     'text': 'Cannot read file due to syntax error:   - No terminal matches ''}'' in the current parser context',
43    \     'detail': 'F0001: Cannot read file due to syntax error:   - No terminal matches ''}'' in the current parser context',
44    \   },
45    \ ],
46    \ ale#handlers#openscad#SCA2D_callback(bufnr(''), [
47    \ 'awesome_project.scad:1:1: F0001: Cannot read file due to syntax error:',
48    \ '   - No terminal matches ''}'' in the current parser context, at line 1 col 37',
49    \ '   - ',
50    \ '   - translate([ 0, 0, 0 ]) { circle(10) }',
51    \ '   -                                     ^',
52    \ '   - Expected one of: ',
53    \ '   - 	* IF',
54    \ '   - 	* LET',
55    \ '   - 	* FOR',
56    \ '   - 	* FUNC_CALL_NAME',
57    \ '   - 	* TERMINATION',
58    \ '   - 	* STAR',
59    \ '   - 	* LBRACE',
60    \ '   - 	* BANG',
61    \ '   - 	* ASSIGN',
62    \ '   - 	* PERCENT',
63    \ '   - 	* HASH',
64    \ '   - 	* INTERSECTION_FOR',
65    \ '   - ',
66    \ 'If you believe this is a bug in SCA2D please report it to us.',
67    \ '',
68    \ '',
69    \ 'SCA2D message summary',
70    \ '=====================',
71    \ 'Fatal errors: 1',
72    \ 'Errors:       0',
73    \ 'Warnings:     0',
74    \ 'Info:         0',
75    \ 'Depreciated   0',
76    \ ])