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

Appearance settings

fix: Sketch preprocessing errors were displayed on stdout instead of stderr #2806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added integration test
  • Loading branch information
cmaglie committed Jan 9, 2025
commit fa37144ca17340dee2a2a5b3f156e91e99c4117b
25 changes: 25 additions & 0 deletions 25 internal/integrationtest/compile_3/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,31 @@ func TestCompilerErrOutput(t *testing.T) {
jsonOut.Query(".compiler_err").MustNotContain(`"fatal error"`)
jsonOut.MustNotContain(`{ "diagnostics" : [] }`)
})

t.Run("PreprocessorErrorsOnStderr", func(t *testing.T) {
// Test the preprocessor errors are present in the diagnostics
// when they are printed on stderr

// prepare sketch
sketch, err := paths.New("testdata", "blink_with_error_directive").Abs()
require.NoError(t, err)

// Run compile and catch err stream
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "-v", "--json", sketch.String())
require.Error(t, err)
jsonOut := requirejson.Parse(t, out)
jsonOut.Query(".compiler_out").MustNotContain(`"error:"`)
jsonOut.Query(".compiler_err").MustContain(`"error:"`)
jsonOut.Query(`.builder_result.diagnostics`).MustContain(`
[
{
"severity": "ERROR",
"message": "#error void setup(){} void loop(){}\n #error void setup(){} void loop(){}\n ^~~~~",
"line": 1,
"column": 2
}
]`)
})
}

func TestCompileRelativeLibraryPath(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#error void setup(){} void loop(){}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.