-
Notifications
You must be signed in to change notification settings - Fork 0
/
match_test.go
45 lines (40 loc) · 1004 Bytes
/
match_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"testing"
)
func TestIsIgnoredFile(t *testing.T) {
tests := []struct {
filename string
expected bool
}{
{"release-installer_0.5.0_checksums.txt", true},
{"checksums", true},
{"checksums.txt", true},
{"checksum.json", true},
{"sha256sums.txt", true},
{"sops-v3.9.0.linux.amd64", false},
}
for _, test := range tests {
match := isIgnoredFile(test.filename)
if match != test.expected {
t.Errorf("For filename %s, expected %v, but got %v", test.filename, test.expected, match)
}
}
}
func TestMuslRe(t *testing.T) {
tests := []struct {
filename string
expected bool
}{
{"monit-5.34.0-linux-x64-musl.tar.gz", true},
{"monit-5.34.0-linux-x64.tar.gz", false},
{"monit-musli.tar.gz", false},
{"monit-5.34.0-linux-x64-musl", true},
}
for _, test := range tests {
match := muslRe.MatchString(test.filename)
if match != test.expected {
t.Errorf("For filename %s, expected %v, but got %v", test.filename, test.expected, match)
}
}
}