Skip to content

Commit 6b7ef9f

Browse files
committed
Finder tests tiny refactoring using test table
1 parent 4ed1e14 commit 6b7ef9f

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

finders_test.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,26 @@ import (
66
)
77

88
func Test_FindManifests(t *testing.T) {
9+
tables := []struct {
10+
file string
11+
}{
12+
{"Info.plist"},
13+
{"AndroidManifest.xml"},
14+
{"Package.appxmanifest"},
15+
}
16+
917
// scan current folder
1018
dir, err := os.Getwd()
1119
check(err)
12-
1320
foundFiles, err := findManifests(dir, []packageHandler{iOSHandler{}, androidHandler{}, uwpHandler{}})
21+
1422
if foundFiles == nil || len(foundFiles) == 0 {
1523
t.Errorf("at least one file should be found")
1624
}
1725

18-
if !containsStructFieldValue(foundFiles, "Path", "Info.plist") {
19-
t.Errorf("test file info.plist has not been found, expected %v", "test/Info.plist")
20-
}
21-
22-
if !containsStructFieldValue(foundFiles, "Path", "AndroidManifest.xml") {
23-
t.Errorf("test file androidmanifest.xml has not been found, expected %v", "test/AndroidManifest.xml")
24-
}
25-
26-
if !containsStructFieldValue(foundFiles, "Path", "Package.appxmanifest") {
27-
t.Errorf("test file package.appxmanifest has not been found, expected %v", "test/Package.appxmanifest")
26+
for _, table := range tables {
27+
if !containsStructFieldValue(foundFiles, "Path", table.file) {
28+
t.Errorf("test file info.plist has not been found, expected %v", "test/Info.plist")
29+
}
2830
}
2931
}

0 commit comments

Comments
 (0)