@@ -43,3 +43,29 @@ func TestCompileWithProfiles(t *testing.T) {
4343 _ , _ , err = cli .Run ("compile" , "-m" , "avr2" , sketchPath .String ())
4444 require .NoError (t , err )
4545}
46+
47+ func TestBuilderDidNotCatchLibsFromUnusedPlatforms (t * testing.T ) {
48+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
49+ defer env .CleanUp ()
50+
51+ // Init the environment explicitly
52+ _ , _ , err := cli .Run ("core" , "update-index" )
53+ require .NoError (t , err )
54+
55+ // copy sketch into the working directory
56+ sketchPath := cli .CopySketch ("sketch_with_error_including_wire" )
57+
58+ // install two platforms with the Wire library bundled
59+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr" )
60+ require .NoError (t , err )
61+ _ , _ , err = cli .Run ("core" , "install" , "arduino:samd" )
62+ require .NoError (t , err )
63+
64+ // compile for AVR
65+ stdout , stderr , err := cli .Run ("compile" , "-b" , "arduino:avr:uno" , sketchPath .String ())
66+ require .Error (t , err )
67+
68+ // check that the libary resolver did not take the SAMD bundled Wire library into account
69+ require .NotContains (t , string (stdout ), "samd" )
70+ require .NotContains (t , string (stderr ), "samd" )
71+ }
0 commit comments