Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c1b290a

Browse files
committed
Added integration test
1 parent cae59be commit c1b290a

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// This file is part of arduino-cli.
2+
//
3+
// Copyright 2024 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 license@arduino.cc.
15+
16+
package compile
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 TestBuildCacheLibWithNonASCIIChars(t *testing.T) {
27+
// See: https://github.com/arduino/arduino-cli/issues/2671
28+
29+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
30+
t.Cleanup(env.CleanUp)
31+
32+
tmpUserDir, err := paths.MkTempDir("", "Håkan")
33+
require.NoError(t, err)
34+
t.Cleanup(func() { tmpUserDir.RemoveAll() })
35+
customEnv := cli.GetDefaultEnv()
36+
customEnv["ARDUINO_DIRECTORIES_USER"] = tmpUserDir.String()
37+
38+
// Install Arduino AVR Boards and Servo lib
39+
_, _, err = cli.Run("core", "install", "arduino:avr@1.8.6")
40+
require.NoError(t, err)
41+
_, _, err = cli.RunWithCustomEnv(customEnv, "lib", "install", "Servo")
42+
require.NoError(t, err)
43+
44+
// Make a temp sketch
45+
sketchDir := tmpUserDir.Join("ServoSketch")
46+
sketchFile := sketchDir.Join("ServoSketch.ino")
47+
require.NoError(t, sketchDir.Mkdir())
48+
require.NoError(t, sketchFile.WriteFile(
49+
[]byte("#include <Servo.h>\nvoid setup() {}\nvoid loop() {}\n"),
50+
))
51+
52+
// Compile sketch
53+
_, _, err = cli.RunWithCustomEnv(customEnv, "compile", "-b", "arduino:avr:uno", sketchFile.String())
54+
require.NoError(t, err)
55+
56+
// Compile sketch again
57+
out, _, err := cli.RunWithCustomEnv(customEnv, "compile", "-b", "arduino:avr:uno", "-v", sketchFile.String())
58+
require.NoError(t, err)
59+
require.Contains(t, string(out), "Compiling library \"Servo\"\nUsing previously compiled file")
60+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /