@@ -150,3 +150,33 @@ func TestCompileWithCustomBuildPath(t *testing.T) {
150
150
require .NoFileExists (t , buildDir .Join (sketchName + ".ino.with_bootloader.bin" ).String ())
151
151
require .NoFileExists (t , buildDir .Join (sketchName + ".ino.with_bootloader.hex" ).String ())
152
152
}
153
+
154
+ func TestCompileWithInvalidUrl (t * testing.T ) {
155
+ env , cli := integrationtest .CreateArduinoCLIWithEnvironment (t )
156
+ defer env .CleanUp ()
157
+
158
+ // Init the environment explicitly
159
+ _ , _ , err := cli .Run ("core" , "update-index" )
160
+ require .NoError (t , err )
161
+
162
+ // Download latest AVR
163
+ _ , _ , err = cli .Run ("core" , "install" , "arduino:avr" )
164
+ require .NoError (t , err )
165
+
166
+ sketchName := "CompileWithInvalidURL"
167
+ sketchPath := cli .SketchbookDir ().Join (sketchName )
168
+ fqbn := "arduino:avr:uno"
169
+
170
+ // Create a test sketch
171
+ _ , _ , err = cli .Run ("sketch" , "new" , sketchPath .String ())
172
+ require .NoError (t , err )
173
+
174
+ _ , _ , err = cli .Run ("config" , "init" , "--dest-dir" , "." , "--additional-urls" , "https://example.com/package_example_index.json" )
175
+ require .NoError (t , err )
176
+
177
+ _ , stderr , err := cli .Run ("compile" , "-b" , fqbn , sketchPath .String ())
178
+ require .NoError (t , err )
179
+ require .Contains (t , string (stderr ), "Error initializing instance: Loading index file: loading json index file" )
180
+ expectedIndexfile := cli .DataDir ().Join ("package_example_index.json" )
181
+ require .Contains (t , string (stderr ), "loading json index file " + expectedIndexfile .String ()+ ": open " + expectedIndexfile .String ()+ ":" )
182
+ }
0 commit comments