Skip to content

Commit 602a257

Browse files
Add TestCompileWithDefaultProfile to integration tests
1 parent b2b2e3c commit 602a257

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

Diff for: internal/integrationtest/profiles/profiles_test.go

+31
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,34 @@ func TestBuilderDidNotCatchLibsFromUnusedPlatforms(t *testing.T) {
6969
require.NotContains(t, string(stdout), "samd")
7070
require.NotContains(t, string(stderr), "samd")
7171
}
72+
73+
func TestCompileWithDefaultProfile(t *testing.T) {
74+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
75+
defer env.CleanUp()
76+
77+
// Init the environment explicitly
78+
_, _, err := cli.Run("core", "update-index")
79+
require.NoError(t, err)
80+
81+
// copy sketch_with_profile into the working directory
82+
sketchPath := cli.CopySketch("sketch_with_profile")
83+
84+
// compile using the default profile
85+
_, _, err = cli.Run("compile", sketchPath.String())
86+
require.NoError(t, err)
87+
88+
// compile using fqbn -> should fail because no core is installed
89+
_, _, err = cli.Run("compile", "-b", "arduino:samd:mkr1000", sketchPath.String())
90+
require.Error(t, err)
91+
92+
// install the required core and library
93+
_, _, err = cli.Run("core", "install", "arduino:samd")
94+
require.NoError(t, err)
95+
_, _, err = cli.Run("lib", "install", "Arduino_JSON")
96+
require.NoError(t, err)
97+
98+
// compile using a different fbqn -> should have priority over the default profile
99+
stdout, _, err := cli.Run("compile", "-b", "arduino:samd:mkr1000", sketchPath.String())
100+
require.NoError(t, err)
101+
require.Contains(t, string(stdout), "arduino:samd")
102+
}

Diff for: internal/integrationtest/testdata/sketch_with_profile/sketch.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ profiles:
1010
- platform: arduino:avr (1.8.5)
1111
libraries:
1212
- Arduino_JSON (0.1.0)
13+
14+
default_profile: avr2

0 commit comments

Comments
 (0)