@@ -22,6 +22,7 @@ import (
22
22
"github.com/arduino/go-paths-helper"
23
23
"github.com/arduino/go-properties-orderedmap"
24
24
"github.com/stretchr/testify/require"
25
+ "go.bug.st/testifyjson/requirejson"
25
26
)
26
27
27
28
func TestRuntimeToolPropertiesGeneration (t * testing.T ) {
@@ -72,3 +73,22 @@ func TestRuntimeToolPropertiesGeneration(t *testing.T) {
72
73
require .True (t , res .GetPath ("runtime.tools.avrdude.path" ).EquivalentTo (hardwareDir .Join ("arduino" , "tools" , "avrdude" , "6.3.0-arduino17" )))
73
74
}
74
75
}
76
+
77
+ func TestCompilerErrOutput (t * testing.T ) {
78
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
79
+ defer env .CleanUp ()
80
+
81
+ // Run update-index with our test index
82
+ _ ,
_ ,
err := cli .
Run (
"core" ,
"install" ,
"arduino:[email protected] " )
83
+ require .NoError (t , err )
84
+
85
+ // prepare sketch
86
+ sketch , err := paths .New ("testdata" , "blink_with_wrong_cpp" ).Abs ()
87
+ require .NoError (t , err )
88
+
89
+ // Run compile and catch err stream
90
+ out , _ , err := cli .Run ("compile" , "-b" , "arduino:avr:uno" , "--format" , "json" , sketch .String ())
91
+ require .Error (t , err )
92
+ compilerErr := requirejson .Parse (t , out ).Query (".compiler_err" )
93
+ compilerErr .MustContain (`"error"` )
94
+ }
0 commit comments