Skip to content

Commit

Permalink
Added integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Aug 17, 2023
1 parent 9ee79f6 commit 38f33e6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
33 changes: 25 additions & 8 deletions internal/integrationtest/compile_3/compile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,32 @@ func TestCompilerErrOutput(t *testing.T) {
_, _, err := cli.Run("core", "install", "arduino:[email protected]")
require.NoError(t, err)

// prepare sketch
sketch, err := paths.New("testdata", "blink_with_wrong_cpp").Abs()
require.NoError(t, err)
{
// prepare sketch
sketch, err := paths.New("testdata", "blink_with_wrong_cpp").Abs()
require.NoError(t, err)

// Run compile and catch err stream
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "--format", "json", sketch.String())
require.Error(t, err)
compilerErr := requirejson.Parse(t, out).Query(".compiler_err")
compilerErr.MustContain(`"error"`)
}

// Run compile and catch err stream
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "--format", "json", sketch.String())
require.Error(t, err)
compilerErr := requirejson.Parse(t, out).Query(".compiler_err")
compilerErr.MustContain(`"error"`)
// Check that library discover do not generate false errors
// https://github.com/arduino/arduino-cli/issues/2263
{
// prepare sketch
sketch, err := paths.New("testdata", "using_Wire").Abs()
require.NoError(t, err)

// Run compile and catch err stream
out, _, err := cli.Run("compile", "-b", "arduino:avr:uno", "-v", "--format", "json", sketch.String())
require.NoError(t, err)
jsonOut := requirejson.Parse(t, out)
jsonOut.Query(".compiler_out").MustNotContain(`"fatal error"`)
jsonOut.Query(".compiler_err").MustNotContain(`"fatal error"`)
}
}

func TestCompileRelativeLibraryPath(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <Wire.h>

void setup() {}
void loop() {}

0 comments on commit 38f33e6

Please sign in to comment.