Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1b995f2

Browse files
committed
Added integration test
1 parent e22ff66 commit 1b995f2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

‎internal/integrationtest/compile_3/compile_test.go‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,31 @@ func TestCompilerErrOutput(t *testing.T) {
195195
jsonOut.Query(".compiler_err").MustNotContain(`"fatal error"`)
196196
jsonOut.MustNotContain(`{ "diagnostics" : [] }`)
197197
})
198+
199+
t.Run("PreprocessorErrorsOnStderr", func(t *testing.T) {
200+
// Test the preprocessor errors are present in the diagnostics
201+
// when they are printed on stderr
202+
203+
// prepare sketch
204+
sketch, err := paths.New("testdata", "blink_with_error_directive").Abs()
205+
require.NoError(t, err)
206+
207+
// Run compile and catch err stream
208+
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "-v", "--json", sketch.String())
209+
require.Error(t, err)
210+
jsonOut := requirejson.Parse(t, out)
211+
jsonOut.Query(".compiler_out").MustNotContain(`"error:"`)
212+
jsonOut.Query(".compiler_err").MustContain(`"error:"`)
213+
jsonOut.Query(`.builder_result.diagnostics`).MustContain(`
214+
[
215+
{
216+
"severity": "ERROR",
217+
"message": "#error void setup(){} void loop(){}\n #error void setup(){} void loop(){}\n ^~~~~",
218+
"line": 1,
219+
"column": 2
220+
}
221+
]`)
222+
})
198223
}
199224

200225
func TestCompileRelativeLibraryPath(t *testing.T) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /