summaryrefslogtreecommitdiff
path: root/test/handler/test_gcc_handler.vader
blob: 72b7c541da71208b66cc840f092b996664ceff95 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Execute(GCC errors from included files should be parsed correctly):
  AssertEqual
  \ [
  \   {
  \     'lnum': 3,
  \     'type': 'E',
  \     'text': 'Problems were found in the header (See :ALEDetail)',
  \     'detail': join([
  \       'broken.h:1:1: error: expected identifier or ''('' before ''{'' token',
  \       ' {{{',
  \       ' ^',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#gcc#HandleGCCFormat(347, [
  \   'In file included from <stdin>:3:0:',
  \   'broken.h:1:1: error: expected identifier or ''('' before ''{'' token',
  \   ' {{{',
  \   ' ^',
  \ ])

  AssertEqual
  \ [
  \   {
  \     'lnum': 3,
  \     'type': 'E',
  \     'text': 'Problems were found in the header (See :ALEDetail)',
  \     'detail': join([
  \       'b.h:1:1: error: expected identifier or ''('' before ''{'' token',
  \       ' {{{',
  \       ' ^',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#gcc#HandleGCCFormat(347, [
  \   'In file included from a.h:1:0,',
  \   '                 from test.c:3:',
  \   'b.h:1:1: error: expected identifier or ''('' before ''{'' token',
  \   ' {{{',
  \   ' ^',
  \ ])

  AssertEqual
  \ [
  \   {
  \     'lnum': 3,
  \     'type': 'E',
  \     'text': 'Problems were found in the header (See :ALEDetail)',
  \     'detail': join([
  \       'b.h:1:1: error: unknown type name ‘bad_type’',
  \       ' bad_type x;',
  \       ' ^',
  \       'b.h:2:1: error: unknown type name ‘other_bad_type’',
  \       ' other_bad_type y;',
  \       ' ^',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#gcc#HandleGCCFormat(347, [
  \   'In file included from a.h:1:0,',
  \   '                 from test.c:3:',
  \   'b.h:1:1: error: unknown type name ‘bad_type’',
  \   ' bad_type x;',
  \   ' ^',
  \   'b.h:2:1: error: unknown type name ‘other_bad_type’',
  \   ' other_bad_type y;',
  \   ' ^',
  \ ])

Execute(GCC versions should be parsed correctly):
  AssertEqual [4, 9, 1], ale#handlers#gcc#ParseGCCVersion([
  \ 'g++ (GCC) 4.9.1 20140922 (Red Hat 4.9.1-10)',
  \])
  AssertEqual [4, 8, 4], ale#handlers#gcc#ParseGCCVersion([
  \ 'gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4',
  \ 'Copyright (C) 2013 Free Software Foundation, Inc.',
  \ 'This is free software; see the source for copying conditions.  There is NO',
  \ 'warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.',
  \])

Execute(The GCC handler shouldn't complain about #pragma once for headers):
  silent file! test.h

  AssertEqual
  \ [],
  \ ale#handlers#gcc#HandleGCCFormat(347, [
  \   '<stdin>:1:1: warning: #pragma once in main file [enabled by default]',
  \ ])

  silent file! test.hpp

  AssertEqual
  \ [],
  \ ale#handlers#gcc#HandleGCCFormat(347, [
  \   '<stdin>:1:1: warning: #pragma once in main file [enabled by default]',
  \ ])