@@ -257,6 +257,7 @@ func TestUploadCommands(t *testing.T) {
257
257
func TestLibSearch (t * testing.T ) {
258
258
defer makeTempDataDir (t )()
259
259
defer makeTempSketchbookDir (t )()
260
+ defer useSharedDownloadDir (t )()
260
261
261
262
exitCode , output := executeWithArgs (t , "lib" , "search" , "audiozer" , "--format" , "json" )
262
263
require .Zero (t , exitCode , "process exit code" )
@@ -287,6 +288,7 @@ func TestLibSearch(t *testing.T) {
287
288
func TestUserLibs (t * testing.T ) {
288
289
defer makeTempDataDir (t )()
289
290
defer makeTempSketchbookDir (t )()
291
+ defer useSharedDownloadDir (t )()
290
292
libDir := currSketchbookDir .Join ("libraries" )
291
293
err := libDir .MkdirAll ()
292
294
require .NoError (t , err , "creating 'sketchbook/libraries' dir" )
@@ -323,6 +325,7 @@ func TestSketchCommands(t *testing.T) {
323
325
defer makeTempSketchbookDir (t )()
324
326
//var d []byte
325
327
var exitCode int
328
+ defer useSharedDownloadDir (t )()
326
329
327
330
exitCode , _ = executeWithArgs (t , "sketch" , "new" , "Test" )
328
331
require .Zero (t , exitCode , "exit code" )
@@ -333,6 +336,7 @@ func TestLibDownloadAndInstall(t *testing.T) {
333
336
defer makeTempSketchbookDir (t )()
334
337
var d []byte
335
338
var exitCode int
339
+ defer useSharedDownloadDir (t )()
336
340
337
341
exitCode , _ = executeWithArgs (t , "core" , "update-index" )
338
342
require .Zero (t , exitCode , "exit code" )
@@ -475,6 +479,7 @@ func detectLatestAVRCore(t *testing.T) string {
475
479
func TestCompileCommands (t * testing.T ) {
476
480
defer makeTempDataDir (t )()
477
481
defer makeTempSketchbookDir (t )()
482
+ defer useSharedDownloadDir (t )()
478
483
479
484
// Set staging dir to a temporary dir
480
485
tmp , err := ioutil .TempDir (os .TempDir (), "test" )
@@ -532,6 +537,7 @@ func TestCompileCommands(t *testing.T) {
532
537
func TestInvalidCoreURL (t * testing.T ) {
533
538
defer makeTempDataDir (t )()
534
539
defer makeTempSketchbookDir (t )()
540
+ defer useSharedDownloadDir (t )()
535
541
536
542
tmp , err := paths .MkTempDir ("" , "" )
537
543
require .NoError (t , err , "making temporary dir" )
@@ -568,6 +574,7 @@ board_manager:
568
574
func TestCoreCommands (t * testing.T ) {
569
575
defer makeTempDataDir (t )()
570
576
defer makeTempSketchbookDir (t )()
577
+ defer useSharedDownloadDir (t )()
571
578
572
579
// Set staging dir to a temporary dir
573
580
tmp , err := ioutil .TempDir (os .TempDir (), "test" )
@@ -580,15 +587,15 @@ func TestCoreCommands(t *testing.T) {
580
587
// Download a specific core version
581
588
exitCode ,
d := executeWithArgs (
t ,
"core" ,
"download" ,
"arduino:[email protected] " )
582
589
require .Zero (t , exitCode , "exit code" )
583
- require .
Contains (
t ,
string ( d ), "arduino:[email protected] downloaded" )
584
- require .
Contains (
t ,
string ( d ), "arduino:[email protected] downloaded" )
585
- require .
Contains (
t ,
string ( d ), "arduino:[email protected] downloaded" )
586
- require .
Contains (
t ,
string ( d ), "arduino:[email protected] downloaded" )
590
+ require .
Regexp (
t ,
"arduino:[email protected] (already )? downloaded" , string ( d ) )
591
+ require .
Regexp (
t ,
"arduino:[email protected] (already )? downloaded" , string ( d ) )
592
+ require .
Regexp (
t ,
"arduino:[email protected] (already )? downloaded" , string ( d ) )
593
+ require .
Regexp (
t ,
"arduino:[email protected] (already )? downloaded" , string ( d ) )
587
594
588
595
// Download latest
589
596
exitCode , d = executeWithArgs (t , "core" , "download" , "arduino:avr" )
590
597
require .Zero (t , exitCode , "exit code" )
591
- require .Contains (t , string ( d ), AVR + " downloaded" )
598
+ require .Regexp (t , AVR + " (already )? downloaded" , string ( d ) )
592
599
593
600
// Wrong downloads
594
601
exitCode ,
d = executeWithArgs (
t ,
"core" ,
"download" ,
"arduino:[email protected] " )
0 commit comments