@@ -107,7 +107,7 @@ func TestCompilerErrOutput(t *testing.T) {
107
107
_ ,
_ ,
err := cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
108
108
require .NoError (t , err )
109
109
110
- {
110
+ t . Run ( "Diagnostics" , func ( t * testing. T ) {
111
111
// prepare sketch
112
112
sketch , err := paths .New ("testdata" , "blink_with_wrong_cpp" ).Abs ()
113
113
require .NoError (t , err )
@@ -126,10 +126,11 @@ func TestCompilerErrOutput(t *testing.T) {
126
126
"context": [ { "message": "In function 'void wrong()':" } ]
127
127
}
128
128
]` )
129
- }
129
+ })
130
+
131
+ t .Run ("PreprocessorDiagnostics" , func (t * testing.T ) {
132
+ // Test the preprocessor errors are present in the diagnostics
130
133
131
- // Test the preprocessor errors are present in the diagnostics
132
- {
133
134
// prepare sketch
134
135
sketch , err := paths .New ("testdata" , "blink_with_wrong_include" ).Abs ()
135
136
require .NoError (t , err )
@@ -148,14 +149,15 @@ func TestCompilerErrOutput(t *testing.T) {
148
149
"message": "invalid preprocessing directive #wrong\n #wrong\n ^~~~~",
149
150
}
150
151
]` )
151
- }
152
+ })
153
+
154
+ t .Run ("PreprocessorDiagnosticsWithLibErrors" , func (t * testing.T ) {
155
+ // Test the preprocessor errors are present in the diagnostics.
156
+ // In case we have 2 libraries:
157
+ // 1. one is missing
158
+ // 2. the other one is missing only from the first GCC run
159
+ // The diagnostics should report only 1 missing library.
152
160
153
- // Test the preprocessor errors are present in the diagnostics.
154
- // In case we have 2 libraries:
155
- // 1. one is missing
156
- // 2. the other one is missing only from the first GCC run
157
- // The diagnostics should report only 1 missing library.
158
- {
159
161
// prepare sketch
160
162
sketch , err := paths .New ("testdata" , "using_Wire_with_missing_lib" ).Abs ()
161
163
require .NoError (t , err )
@@ -175,11 +177,12 @@ func TestCompilerErrOutput(t *testing.T) {
175
177
"column": 10,
176
178
}
177
179
]` )
178
- }
180
+ })
181
+
182
+ t .Run ("LibraryDiscoverFalseErrors" , func (t * testing.T ) {
183
+ // Check that library discover do not generate false errors
184
+ // https://github.com/arduino/arduino-cli/issues/2263
179
185
180
- // Check that library discover do not generate false errors
181
- // https://github.com/arduino/arduino-cli/issues/2263
182
- {
183
186
// prepare sketch
184
187
sketch , err := paths .New ("testdata" , "using_Wire" ).Abs ()
185
188
require .NoError (t , err )
@@ -191,7 +194,7 @@ func TestCompilerErrOutput(t *testing.T) {
191
194
jsonOut .Query (".compiler_out" ).MustNotContain (`"fatal error"` )
192
195
jsonOut .Query (".compiler_err" ).MustNotContain (`"fatal error"` )
193
196
jsonOut .MustNotContain (`{ "diagnostics" : [] }` )
194
- }
197
+ })
195
198
}
196
199
197
200
func TestCompileRelativeLibraryPath (t * testing.T ) {
0 commit comments