@@ -107,15 +107,32 @@ func TestCompilerErrOutput(t *testing.T) {
107107 _ , _ , err := cli .Run ("core" , "install" , "arduino:avr@1.8.5" )
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
121138func TestCompileRelativeLibraryPath (t * testing.T ) {
0 commit comments