Skip to content

Commit 057516d

Browse files
committed
Added integration test for #1698
1 parent 6992de7 commit 057516d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

internal/integrationtest/compile_3/compile_test.go

Lines changed: 20 additions & 0 deletions
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) {
@@ -96,3 +97,22 @@ func TestCompileBuildPathInsideSketch(t *testing.T) {
9697
_, _, err = cli.Run("compile", "-b", "arduino:avr:mega", "--build-path", "build-mega")
9798
require.NoError(t, err)
9899
}
100+
101+
func TestCompilerErrOutput(t *testing.T) {
102+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
103+
defer env.CleanUp()
104+
105+
// Run update-index with our test index
106+
_, _, err := cli.Run("core", "install", "arduino:[email protected]")
107+
require.NoError(t, err)
108+
109+
// prepare sketch
110+
sketch, err := paths.New("testdata", "blink_with_wrong_cpp").Abs()
111+
require.NoError(t, err)
112+
113+
// Run compile and catch err stream
114+
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "--format", "json", sketch.String())
115+
require.Error(t, err)
116+
compilerErr := requirejson.Parse(t, out).Query(".compiler_err")
117+
compilerErr.MustContain(`"error"`)
118+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
void setup() {}
2+
void loop() {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
void wrong() {

0 commit comments

Comments
 (0)