Skip to content

Commit 3cbbdd9

Browse files
author
Christian Foerster
committed
added test for path
1 parent de7d3ae commit 3cbbdd9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/checks/checks_by_file_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package checks
22

33
import (
4+
"fmt"
45
"os"
56
"testing"
67

@@ -157,6 +158,22 @@ func TestIsFreeOfKeywords(t *testing.T) {
157158
content: []byte{0x00, 0x01, 0x02},
158159
expected: nil,
159160
},
161+
{
162+
name: "Path",
163+
file: structs.File{Path: tempFile([]byte("This is some text."))},
164+
keywords: "/Users/",
165+
info: "Keywords found:",
166+
content: []byte("This is some text."),
167+
expected: nil,
168+
},
169+
{
170+
name: "Path2",
171+
file: structs.File{Path: tempFile([]byte("ADHABDAID /Users/"))},
172+
keywords: "/Users/",
173+
info: "Keywords found:",
174+
content: []byte("ADHABDAID /Users/"),
175+
expected: []structs.Message{{Content: "Keywords found: '/Users/'", Source: structs.File{Path: tempFile([]byte("ADHABDAID /Users/"))}}},
176+
},
160177
}
161178

162179
for _, tt := range tests {
@@ -166,6 +183,8 @@ func TestIsFreeOfKeywords(t *testing.T) {
166183
t.Errorf("expected %v, got %v", tt.expected, result)
167184
}
168185
for i := range result {
186+
fmt.Println(result[i].Content)
187+
fmt.Println(tt.expected[i].Content)
169188
if result[i].Content != tt.expected[i].Content {
170189
t.Errorf("expected %v, got %v", tt.expected[i].Content, result[i].Content)
171190
}

0 commit comments

Comments
 (0)