Skip to content

Commit e94bc05

Browse files
committed
chore: add pem testcase
1 parent 3e6a544 commit e94bc05

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

pkg/postprocess/pem_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package postprocess
2+
3+
import "testing"
4+
5+
func TestIsPem(t *testing.T) {
6+
type args struct {
7+
cc string
8+
}
9+
tests := []struct {
10+
name string
11+
text []byte
12+
isSecret bool
13+
}{
14+
{
15+
"Invalid private pem file",
16+
[]byte("Random Binary Data"),
17+
false,
18+
},
19+
{
20+
"Invalid private pem file",
21+
[]byte("This is not a pem file."),
22+
false,
23+
},
24+
{
25+
"Invalid private pem file",
26+
[]byte("Non-pem File"),
27+
false,
28+
},
29+
}
30+
for _, tt := range tests {
31+
t.Run(tt.name, func(t *testing.T) {
32+
if got := IsPrivatePem(tt.text); got != tt.isSecret {
33+
t.Errorf("TestIsPem() = %v, want %v", got, tt.isSecret)
34+
}
35+
})
36+
}
37+
}

0 commit comments

Comments
 (0)