@@ -69,3 +69,34 @@ func TestBuilderDidNotCatchLibsFromUnusedPlatforms(t *testing.T) {
69
69
require .NotContains (t , string (stdout ), "samd" )
70
70
require .NotContains (t , string (stderr ), "samd" )
71
71
}
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
+ }
0 commit comments