-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_test.go
42 lines (38 loc) · 848 Bytes
/
config_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
package main
import (
"fmt"
"testing"
)
func TestFilePathWalkDir(t *testing.T) {
actual, err := walkCfgDir("")
if err != nil {
t.Errorf("Cannot read directory!")
}
if actual != nil {
fmt.Printf("actual: %v\n", actual)
}
}
func TestFilePathAnyDir(t *testing.T) {
actual, err := walkCfgDir(".")
if err != nil {
t.Errorf("Cannot read directory!")
}
if actual != nil {
fmt.Printf("actual: %v\n", actual)
}
}
func TestIOReadFilePath(t *testing.T) {
expected := []string{"node1", "node2", "node3"}
files, _ := walkCfgDir("")
fmt.Printf("=====> %v\n", files)
for i, file := range files {
actual, err := readPaths(file)
if err != nil {
t.Errorf("Cannot read directory!")
}
if actual != nil {
fmt.Printf("actual: idx=%d paths=%v len=%v\n", i, actual, len(actual))
fmt.Printf("expected: %v\n", expected)
}
}
}