Skip to content

Commit efd89c5

Browse files
committed
Added integration test for arduino#1698
1 parent 425aaf0 commit efd89c5

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

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

+20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/arduino/go-paths-helper"
2323
"github.com/arduino/go-properties-orderedmap"
2424
"github.com/stretchr/testify/require"
25+
"go.bug.st/testifyjson/requirejson"
2526
)
2627

2728
func TestRuntimeToolPropertiesGeneration(t *testing.T) {
@@ -72,3 +73,22 @@ func TestRuntimeToolPropertiesGeneration(t *testing.T) {
7273
require.True(t, res.GetPath("runtime.tools.avrdude.path").EquivalentTo(hardwareDir.Join("arduino", "tools", "avrdude", "6.3.0-arduino17")))
7374
}
7475
}
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
void setup() {}
2+
void loop() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void wrong() {

0 commit comments

Comments
 (0)