Skip to content

Commit 33d7837

Browse files
committed
Fixed unit-test
1 parent 7e8313f commit 33d7837

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

internal/cli/check-registry/check-registry_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestRegistryValidation(t *testing.T) {
1616
tests := []testcase{
1717
{"EmptyArg", "", "registry data file argument testdata is a folder, not a file"},
1818
{"NonExistentFile", "nonexistent.txt", "while loading registry data file: stat testdata/nonexistent.txt: no such file or directory"},
19-
//{"InvalidDataFormat", "invalid-data-format.txt", "while loading registry data file: invalid line format (3 fields are required): https://github.com/arduino-libraries/SD.git|Partner;SD"},
19+
{"InvalidDataFormat", "invalid-data-format.txt", "while loading registry data file: invalid line format (3 fields are required): https://github.com/arduino-libraries/SD.git|Partner;SD"},
2020
{"InvalidUrlFormat", "invalid-url-format.txt", "while filtering registry data file: Following URL are unknown or unsupported git repos:\nhttps://github.com/arduino-libraries/SD\n"},
2121
{"MissingType", "no-type.txt", "invalid type '' used by library 'SD'"},
2222
{"InvalidType", "invalid-type.txt", "invalid type 'foo' used by library 'SD'"},

internal/libraries/repolist.go

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ func LoadRepoListFromFile(filename string) ([]*Repo, error) {
5050
line = strings.TrimSpace(line)
5151
if len(line) > 0 && line[0] != '#' {
5252
split := strings.Split(line, "|")
53+
if len(split) < 3 {
54+
return nil, fmt.Errorf("invalid line format (3 fields are required): %s", line)
55+
}
5356
url := split[0]
5457
types := strings.Split(split[1], ",")
5558
name := split[2]

0 commit comments

Comments
 (0)