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 86cde78

Browse files
committed
Added integration test
1 parent 6c4fd2a commit 86cde78

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

‎internal/cli/compile/compile.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ type compileResult struct {
400400
Success bool `json:"success"`
401401
ProfileOut string `json:"profile_out,omitempty"`
402402
Error string `json:"error,omitempty"`
403-
Diagnostics []*result.CompileDiagnostic `json:"diagnostics"`
403+
Diagnostics []*result.CompileDiagnostic `json:"diagnostics,omitempty"`
404404
showPropertiesMode arguments.ShowPropertiesMode
405405
hideStats bool
406406
}

‎internal/integrationtest/compile_3/compile_test.go‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,17 @@ func TestCompilerErrOutput(t *testing.T) {
115115
// Run compile and catch err stream
116116
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "--format", "json", sketch.String())
117117
require.Error(t, err)
118-
compilerErr := requirejson.Parse(t, out).Query(".compiler_err")
119-
compilerErr.MustContain(`"error"`)
118+
outJson := requirejson.Parse(t, out)
119+
outJson.Query(`.compiler_err`).MustContain(`"error"`)
120+
outJson.Query(`.diagnostics`).MustContain(`
121+
[
122+
{
123+
"severity": "ERROR",
124+
"line": 1,
125+
"column": 14,
126+
"context": [ { "message": "In function 'void wrong()':" } ]
127+
}
128+
]`)
120129
}
121130

122131
// Check that library discover do not generate false errors
@@ -132,6 +141,7 @@ func TestCompilerErrOutput(t *testing.T) {
132141
jsonOut := requirejson.Parse(t, out)
133142
jsonOut.Query(".compiler_out").MustNotContain(`"fatal error"`)
134143
jsonOut.Query(".compiler_err").MustNotContain(`"fatal error"`)
144+
jsonOut.MustNotContain(`{ "diagnostics" : [] }`)
135145
}
136146
}
137147

0 commit comments

Comments
(0)

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