-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscanner_local_test.go
More file actions
32 lines (27 loc) · 853 Bytes
/
scanner_local_test.go
File metadata and controls
32 lines (27 loc) · 853 Bytes
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
//go:build local
package main
import (
"bytes"
"flag"
"testing"
)
// Check basic scanner functionality. That scan returns a single entry which is also the
// one with the most recent DTM. Unfortunately this test fails on github for reasons to do
// with their funky file-system so it's only run on local development systems.
func TestScannerBasic(t *testing.T) {
var stderr bytes.Buffer
cfg := newConfig(flag.NewFlagSet(Name, flag.ContinueOnError),
func() (string, error) { return "", nil })
scn, can, err := testScannerSetup(cfg, &stderr, 10)
if err != nil {
t.Fatal(err)
}
scn.descend(0, "testdata/scan10")
scn.wait()
if len(can.cf) != 1 {
t.Fatal("Expected 1 entry from testdata/scan10, got", len(can.cf))
}
if can.cf[0].path != "testdata/scan10/README" {
t.Error("Expected scan to return README, not", can.cf[0].path)
}
}