Skip to content

Commit cfd0da2

Browse files
Add test to verify that LoadSketchResponse contains the profiles
1 parent af46739 commit cfd0da2

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

commands/sketch/load_test.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 sketch
17+
18+
import (
19+
"context"
20+
"testing"
21+
22+
"github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
23+
"github.com/stretchr/testify/require"
24+
)
25+
26+
func TestLoadSketchProfiles(t *testing.T) {
27+
loadResp, err := LoadSketch(context.Background(), &commands.LoadSketchRequest{
28+
SketchPath: "./testdata/sketch_with_profile",
29+
})
30+
require.NoError(t, err)
31+
require.Len(t, loadResp.GetProfiles(), 2)
32+
require.Equal(t, loadResp.GetDefaultProfile().GetName(), "nanorp")
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
profiles:
2+
nanorp:
3+
fqbn: arduino:avr:uno
4+
platforms:
5+
- platform: arduino:mbed_nano (4.0.2)
6+
libraries:
7+
- ArduinoIoTCloud (1.0.2)
8+
- Arduino_ConnectionHandler (0.6.4)
9+
- TinyDHT sensor library (1.1.0)
10+
11+
another_profile_name:
12+
notes: testing the limit of the AVR platform, may be unstable
13+
fqbn: arduino:avr:uno
14+
platforms:
15+
- platform: arduino:avr (1.8.4)
16+
libraries:
17+
- VitconMQTT (1.0.1)
18+
- Arduino_ConnectionHandler (0.6.4)
19+
- TinyDHT sensor library (1.1.0)
20+
21+
default_profile: nanorp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
void setup() {
3+
}
4+
5+
void loop() {
6+
}

0 commit comments

Comments
 (0)