Skip to content

Commit 4d747c8

Browse files
Add TestCompileWithDefaultProfile to integration tests
1 parent cdef082 commit 4d747c8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

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

+22
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,25 @@ 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 with its fqbn
85+
stdout, _, err := cli.Run("compile", sketchPath.String())
86+
require.NoError(t, err)
87+
require.Contains(t, string(stdout), "arduino:avr")
88+
89+
// compile using a different fbqn -> should have priority over the one in the default profile
90+
stdout, _, err = cli.Run("compile", "-b", "arduino:samd:mkr1000", sketchPath.String())
91+
require.NoError(t, err)
92+
require.Contains(t, string(stdout), "arduino:samd")
93+
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ profiles:
88
fqbn: arduino:avr:uno
99
platforms:
1010
- platform: arduino:avr (1.8.5)
11+
- platform: arduino:samd (1.8.13)
1112
libraries:
1213
- Arduino_JSON (0.1.0)
14+
15+
default_profile: avr2

0 commit comments

Comments
 (0)