You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This file is part of libraries-repository-engine.
2
+
//
3
+
// Copyright 2025 ARDUINO SA (http://www.arduino.cc/)
4
+
//
5
+
// This program is free software: you can redistribute it and/or modify
6
+
// it under the terms of the GNU Affero General Public License as published
7
+
// by the Free Software Foundation, either version 3 of the License, or
8
+
// (at your option) any later version.
9
+
//
10
+
// This program is distributed in the hope that it will be useful,
11
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+
// GNU Affero General Public License for more details.
14
+
//
15
+
// You should have received a copy of the GNU Affero General Public License
16
+
// along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
//
18
+
// You can be released from the requirements of the above licenses by purchasing
19
+
// a commercial license. Buying such a license is mandatory if you want to
20
+
// modify or otherwise use the software for commercial activities involving the
21
+
// Arduino software without disclosing the source code of your own applications.
22
+
// To purchase a commercial license, send an email to [email protected].
23
+
24
+
package checkregistry
25
+
26
+
import (
27
+
"path/filepath"
28
+
"testing"
29
+
30
+
"github.com/stretchr/testify/require"
31
+
)
32
+
33
+
funcTestRegistryValidation(t*testing.T) {
34
+
typetestcasestruct {
35
+
Namestring
36
+
TestFilestring
37
+
ExpectedResultstring
38
+
}
39
+
tests:= []testcase{
40
+
{"EmptyArg", "", "registry data file argument testdata is a folder, not a file"},
41
+
{"NonExistentFile", "nonexistent.txt", "while loading registry data file: stat testdata/nonexistent.txt: no such file or directory"},
42
+
{"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"},
43
+
{"InvalidUrlFormat", "invalid-url-format.txt", "while filtering registry data file: Following URL are unknown or unsupported git repos:\nhttps://github.com/arduino-libraries/SD"},
44
+
{"MissingType", "no-type.txt", "invalid type '' used by library 'SD'"},
45
+
{"InvalidType", "invalid-type.txt", "invalid type 'foo' used by library 'SD'"},
46
+
{"DuplicateRepoURL", "duplicate-url.txt", "registry data file contains duplicate URLs"},
47
+
{"DuplicateLibName", "duplicate-name.txt", "registry data file contains duplicates of name 'SD'"},
0 commit comments