Skip to content

Commit f2939e0

Browse files
committed
Added integration tests
1 parent bad2251 commit f2939e0

File tree

7 files changed

+63
-0
lines changed

7 files changed

+63
-0
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// This file is part of arduino-cli.
2+
//
3+
// Copyright 2023 ARDUINO SA (http://www.arduino.cc/)
4+
//
5+
// This software is released under the GNU General Public License version 3,
6+
// which covers the main part of arduino-cli.
7+
// The terms of this license can be found at:
8+
// https://www.gnu.org/licenses/gpl-3.0.en.html
9+
//
10+
// You can be released from the requirements of the above licenses by purchasing
11+
// a commercial license. Buying such a license is mandatory if you want to
12+
// modify or otherwise use the software for commercial activities involving the
13+
// Arduino software without disclosing the source code of your own applications.
14+
// To purchase a commercial license, send an email to [email protected].
15+
16+
package compile_test
17+
18+
import (
19+
"testing"
20+
21+
"github.com/arduino/arduino-cli/internal/integrationtest"
22+
"github.com/arduino/go-paths-helper"
23+
"github.com/stretchr/testify/require"
24+
)
25+
26+
func TestCompileWithBrokenSymLinks(t *testing.T) {
27+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
28+
t.Cleanup(env.CleanUp)
29+
30+
// Install Arduino AVR Boards
31+
_, _, err := cli.Run("core", "install", "arduino:[email protected]")
32+
require.NoError(t, err)
33+
34+
t.Run("NonSketchFileBroken", func(t *testing.T) {
35+
sketch, err := paths.New("testdata", "ValidSketchWithBrokenSymlink").Abs()
36+
require.NoError(t, err)
37+
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", sketch.String())
38+
require.NoError(t, err)
39+
})
40+
41+
t.Run("SketchFileBroken", func(t *testing.T) {
42+
sketch, err := paths.New("testdata", "ValidSketchWithBrokenSketchFileSymlink").Abs()
43+
require.NoError(t, err)
44+
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", sketch.String())
45+
require.Error(t, err)
46+
})
47+
48+
t.Run("NonInoSketchFileBroken", func(t *testing.T) {
49+
sketch, err := paths.New("testdata", "ValidSketchWithNonInoBrokenSketchFileSymlink").Abs()
50+
require.NoError(t, err)
51+
_, _, err = cli.Run("compile", "-b", "arduino:avr:uno", sketch.String())
52+
require.Error(t, err)
53+
})
54+
}
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+
broken
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+
broken
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+
broken

0 commit comments

Comments
 (0)