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