-
Notifications
You must be signed in to change notification settings - Fork 1
/
replace_shared_test.go
74 lines (66 loc) · 1.69 KB
/
replace_shared_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
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
// -----------------------------------------------------------------------------
// CMDX Utilities Suite cmdx/[replace_shared_test.go]
// (c) [email protected] License: GPLv3
// -----------------------------------------------------------------------------
package main
// to test all items in replace_shared.go use:
// go test --run Test_rsha_
//
// 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_rsha_getConfigBool_
func Test_rsha_getConfigBool_(t *testing.T) {
zr.TBegin(t)
// getConfigBool(s, keyword string) (value, exists bool)
//
test := func(
// in:
s, keyword string,
// out:
value, exists bool,
) {
valueT, existsT := getConfigBool(s, keyword)
zr.TEqual(t, valueT, (value))
zr.TEqual(t, existsT, (exists))
}
test("", "",
// out:
false, false)
}
// go test --run Test_rsha_hasConfigBool_
func Test_rsha_hasConfigBool_(t *testing.T) {
zr.TBegin(t)
// hasConfigBool(s, keyword string) (ret bool)
//
test := func(s, keyword string, ret bool) {
retT := hasConfigBool(s, keyword)
zr.TEqual(t, retT, (ret))
}
test("", "",
// out:
false)
}
// go test --run Test_rsha_readConfigFileLines_
func Test_rsha_readConfigFileLines_(t *testing.T) {
zr.TBegin(t)
// readConfigFileLines(configFile string) (configLines []string)
//
test := func(
// in:
configFile string,
// out:
configLines []string,
) {
configLinesT := readConfigFileLines(configFile)
zr.TEqual(t, configLinesT, (configLines))
}
test("",
// out:
[]string{})
}
// end