@@ -26,9 +26,88 @@ package libraries
26
26
import (
27
27
"testing"
28
28
29
+ "github.com/stretchr/testify/assert"
29
30
"github.com/stretchr/testify/require"
30
31
)
31
32
33
+ func TestLoadRepoListFromFile (t * testing.T ) {
34
+ _ , err := LoadRepoListFromFile ("./testdata/nonexistent.txt" )
35
+ assert .Error (t , err , "Attempt to load non-existent registry data file" )
36
+
37
+ repos , err := LoadRepoListFromFile ("./testdata/git_test_repos.txt" )
38
+ require .NoError (t , err )
39
+
40
+ reposAssertion := []* Repo {
41
+ {
42
+ URL : "https://github.com/arduino-libraries" ,
43
+ Types : []string {"Arduino" },
44
+ LibraryName : "libraries" ,
45
+ },
46
+ {
47
+ URL :
"[email protected] :PaulStoffregen/Audio.git" ,
48
+ Types : []string {"Contributed" },
49
+ LibraryName : "Audio" ,
50
+ },
51
+ {
52
+ URL : "https://github.com/PaulStoffregen/OctoWS2811.git" ,
53
+ Types : []string {"Arduino" , "Contributed" },
54
+ LibraryName : "OctoWS2811" ,
55
+ },
56
+ {
57
+ URL : "https://github.com/PaulStoffregen/AltSoftSerial.git" ,
58
+ Types : []string {"Contributed" },
59
+ LibraryName : "AltSoftSerial" ,
60
+ },
61
+ {
62
+ URL : "https://github.com/Cheong2K/ble-sdk-arduino.git" ,
63
+ Types : []string {"Contributed" },
64
+ LibraryName : "ble-sdk-arduino" ,
65
+ },
66
+ {
67
+ URL : "https://github.com/arduino-libraries/Bridge.git" ,
68
+ Types : []string {"Contributed" },
69
+ LibraryName : "Bridge" ,
70
+ },
71
+ {
72
+ URL : "https://github.com/adafruit/Adafruit_ADS1X15.git" ,
73
+ Types : []string {"Recommended" },
74
+ LibraryName : "Adafruit_ADS1X15" ,
75
+ },
76
+ {
77
+ URL : "https://github.com/adafruit/Adafruit_ADXL345.git" ,
78
+ Types : []string {"Recommended" },
79
+ LibraryName : "Adafruit_ADXL345" ,
80
+ },
81
+ {
82
+ URL : "https://github.com/adafruit/Adafruit_AHRS.git" ,
83
+ Types : []string {"Recommended" },
84
+ LibraryName : "Adafruit_AHRS" ,
85
+ },
86
+ {
87
+ URL : "https://github.com/adafruit/Adafruit_AM2315.git" ,
88
+ Types : []string {"Recommended" },
89
+ LibraryName : "Adafruit_AM2315" ,
90
+ },
91
+ {
92
+ URL : "https://github.com/arduino-libraries/Scheduler.git" ,
93
+ Types : []string {"Arduino" },
94
+ LibraryName : "Scheduler" ,
95
+ },
96
+ {
97
+ URL : "https://github.com/arduino-libraries/SD.git" ,
98
+ Types : []string {"Arduino" },
99
+ LibraryName : "SD" ,
100
+ },
101
+ {
102
+ URL : "https://github.com/arduino-libraries/Servo.git" ,
103
+ Types : []string {"Arduino" },
104
+ LibraryName : "Servo" ,
105
+ },
106
+ }
107
+
108
+ assert .Equal (t , reposAssertion , repos )
109
+ }
110
+
32
111
func TestListRepos (t * testing.T ) {
33
112
repos , err := ListRepos ("./testdata/git_test_repos.txt" )
34
113
0 commit comments