summaryrefslogtreecommitdiff
path: root/test/handler/test_openscad_handler.vader
blob: 36071cc7fdeb032752cd07e547c8f994622e1026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Before:
  call ale#test#SetDirectory('/testplugin/test/handler')

  " Load sca2d
  runtime ale_linters/openscad/sca2d.vim

After:
  call ale#test#RestoreDirectory()
  call ale#linter#Reset()

Execute(The openscad handler should handle sca2d output):
  AssertEqual
  \ [
  \   {
  \     'filename': ale#path#Simplify(g:dir . '/awesome_project.scad'),
  \     'lnum': 7,
  \     'type': 'E',
  \     'col': 42,
  \     'text': 'Module `corcle` used but never defined.',
  \     'detail': 'E2002: Module `corcle` used but never defined.',
  \   },
  \ ],
  \ ale#handlers#openscad#SCA2D_callback(bufnr(''), [
  \  'awesome_project.scad:7:42: E2002: Module `corcle` used but never defined.',
  \   '',
  \   'SCA2D message summary',
  \   '=====================',
  \   'Fatal errors: 0',
  \   'Errors:       1',
  \   'Warnings:     0',
  \   'Info:         0',
  \   'Depreciated   0',
  \ ])

  AssertEqual
  \ [
  \   {
  \     'filename': ale#path#Simplify(g:dir . '/awesome_project.scad'),
  \     'lnum': 1,
  \     'type': 'E',
  \     'col': 37,
  \     'text': 'Cannot read file due to syntax error:   - No terminal matches ''}'' in the current parser context',
  \     'detail': 'F0001: Cannot read file due to syntax error:   - No terminal matches ''}'' in the current parser context',
  \   },
  \ ],
  \ ale#handlers#openscad#SCA2D_callback(bufnr(''), [
  \ 'awesome_project.scad:1:1: F0001: Cannot read file due to syntax error:',
  \ '   - No terminal matches ''}'' in the current parser context, at line 1 col 37',
  \ '   - ',
  \ '   - translate([ 0, 0, 0 ]) { circle(10) }',
  \ '   -                                     ^',
  \ '   - Expected one of: ',
  \ '   - 	* IF',
  \ '   - 	* LET',
  \ '   - 	* FOR',
  \ '   - 	* FUNC_CALL_NAME',
  \ '   - 	* TERMINATION',
  \ '   - 	* STAR',
  \ '   - 	* LBRACE',
  \ '   - 	* BANG',
  \ '   - 	* ASSIGN',
  \ '   - 	* PERCENT',
  \ '   - 	* HASH',
  \ '   - 	* INTERSECTION_FOR',
  \ '   - ',
  \ 'If you belive this is a bug in SCA2D please report it to us.',
  \ '',
  \ '',
  \ 'SCA2D message summary',
  \ '=====================',
  \ 'Fatal errors: 1',
  \ 'Errors:       0',
  \ 'Warnings:     0',
  \ 'Info:         0',
  \ 'Depreciated   0',
  \ ])