@@ -178,3 +178,43 @@ func TestRecompileWithDifferentLibrary(t *testing.T) {
178
178
require .NoError (t , err )
179
179
require .NotContains (t , string (stdout ), "Using previously compiled file: " + objPath .String ())
180
180
}
181
+
182
+ func TestCompileWithConflictingLibrariesInclude (t * testing.T ) {
183
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
184
+ defer env .CleanUp ()
185
+
186
+ _ , _ , err := cli .Run ("update" )
187
+ require .NoError (t , err )
188
+
189
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr@1.8.3" )
190
+ require .NoError (t , err )
191
+
192
+ // Installs conflicting libraries
193
+ gitUrl := "https://github.com/pstolarz/OneWireNg.git"
194
+ oneWireNgLibPath := cli .SketchbookDir ().Join ("libraries" , "onewireng_0_8_1" )
195
+ _ , err = git .PlainClone (oneWireNgLibPath .String (), false , & git.CloneOptions {
196
+ URL : gitUrl ,
197
+ ReferenceName : plumbing .NewTagReferenceName ("0.8.1" ),
198
+ })
199
+ require .NoError (t , err )
200
+
201
+ gitUrl = "https://github.com/PaulStoffregen/OneWire.git"
202
+ oneWireLibPath := cli .SketchbookDir ().Join ("libraries" , "onewire_2_3_5" )
203
+ _ , err = git .PlainClone (oneWireLibPath .String (), false , & git.CloneOptions {
204
+ URL : gitUrl ,
205
+ ReferenceName : plumbing .NewTagReferenceName ("v2.3.5" ),
206
+ })
207
+ require .NoError (t , err )
208
+
209
+ sketchPath := cli .CopySketch ("sketch_with_conflicting_libraries_include" )
210
+ fqbn := "arduino:avr:uno"
211
+
212
+ stdout , _ , err := cli .Run ("compile" , "-b" , fqbn , sketchPath .String (), "--verbose" )
213
+ require .NoError (t , err )
214
+ expectedOutput := [3 ]string {
215
+ "Multiple libraries were found for \" OneWire.h\" " ,
216
+ " Used: " + oneWireLibPath .String (),
217
+ " Not used: " + oneWireNgLibPath .String (),
218
+ }
219
+ require .Contains (t , string (stdout ), expectedOutput [0 ]+ "\n " + expectedOutput [1 ]+ "\n " + expectedOutput [2 ]+ "\n " )
220
+ }
0 commit comments