-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfunc_test.go
More file actions
92 lines (83 loc) · 1.86 KB
/
Copy pathfunc_test.go
File metadata and controls
92 lines (83 loc) · 1.86 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// -----------------------------------------------------------------------------
// CMDX Utilities Suite cmdx/[func_test.go]
// (c) balarabe@protonmail.com License: GPLv3
// -----------------------------------------------------------------------------
package main
// to test all items in func.go use:
// go test --run Test_func_
//
// to generate a test coverage report for the whole module use:
// go test -coverprofile cover.out
// go tool cover -html=cover.out
import (
"testing"
"github.com/balacode/zr"
)
// go test --run Test_func_checksum_
func Test_func_checksum_(t *testing.T) {
zr.TBegin(t)
// checksum(s string) string
//
test := func(
// in:
s string,
// out:
ret string,
) {
retT := checksum(s)
zr.TEqual(t, retT, (ret))
}
test("",
// out:
"000000")
}
// go test --run Test_func_getFilesMap_
func Test_func_getFilesMap_(t *testing.T) {
zr.TBegin(t)
// getFilesMap(dir, filter string) FilesMap
//
test := func(
// in:
dir, filter string,
// out expected:
ret FilesMap) {
retT := getFilesMap(dir, filter)
zr.TEqual(t, retT, (ret))
}
test("", "",
// out:
FilesMap{})
}
// go test --run Test_func_splitArgsFilter_
func Test_func_splitArgsFilter_(t *testing.T) {
zr.TBegin(t)
// splitArgsFilter(args []string) (retArgs []string, filter string)
//
test := func(
// in:
args []string,
// out expected:
retArgs []string, filter string,
) {
retArgsT, filterT := splitArgsFilter(args)
zr.TEqual(t, retArgsT, (retArgs))
zr.TEqual(t, filterT, (filter))
}
test([]string{},
// out:
[]string{}, "")
}
// go test --run Test_func_trim_
func Test_func_trim_(t *testing.T) {
zr.TBegin(t)
// trim(s string) string
//
test := func(s string, ret string) {
retT := trim(s)
zr.TEqual(t, retT, (ret))
}
test("",
// out:
"")
}
// end