Skip to content

Commit 38f33e6

Browse files
committed
Added integration test
1 parent 9ee79f6 commit 38f33e6

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

Diff for: internal/integrationtest/compile_3/compile_test.go

+25-8
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,32 @@ func TestCompilerErrOutput(t *testing.T) {
107107
_, _, err := cli.Run("core", "install", "arduino:[email protected]")
108108
require.NoError(t, err)
109109

110-
// prepare sketch
111-
sketch, err := paths.New("testdata", "blink_with_wrong_cpp").Abs()
112-
require.NoError(t, err)
110+
{
111+
// prepare sketch
112+
sketch, err := paths.New("testdata", "blink_with_wrong_cpp").Abs()
113+
require.NoError(t, err)
114+
115+
// Run compile and catch err stream
116+
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "--format", "json", sketch.String())
117+
require.Error(t, err)
118+
compilerErr := requirejson.Parse(t, out).Query(".compiler_err")
119+
compilerErr.MustContain(`"error"`)
120+
}
113121

114-
// Run compile and catch err stream
115-
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "--format", "json", sketch.String())
116-
require.Error(t, err)
117-
compilerErr := requirejson.Parse(t, out).Query(".compiler_err")
118-
compilerErr.MustContain(`"error"`)
122+
// Check that library discover do not generate false errors
123+
// https://github.com/arduino/arduino-cli/issues/2263
124+
{
125+
// prepare sketch
126+
sketch, err := paths.New("testdata", "using_Wire").Abs()
127+
require.NoError(t, err)
128+
129+
// Run compile and catch err stream
130+
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "-v", "--format", "json", sketch.String())
131+
require.NoError(t, err)
132+
jsonOut := requirejson.Parse(t, out)
133+
jsonOut.Query(".compiler_out").MustNotContain(`"fatal error"`)
134+
jsonOut.Query(".compiler_err").MustNotContain(`"fatal error"`)
135+
}
119136
}
120137

121138
func TestCompileRelativeLibraryPath(t *testing.T) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#include <Wire.h>
2+
3+
void setup() {}
4+
void loop() {}

0 commit comments

Comments
 (0)