-
Notifications
You must be signed in to change notification settings - Fork 1
/
replace_lines_test.go
54 lines (48 loc) · 1.3 KB
/
replace_lines_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
// -----------------------------------------------------------------------------
// CMDX Utilities Suite cmdx/[replace_lines_test.go]
// (c) [email protected] License: GPLv3
// -----------------------------------------------------------------------------
package main
// to test all items in replace_lines.go use:
// go test --run Test_rpln_
//
// 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_rpln_replaceLines_
func Test_rpln_replaceLines_(t *testing.T) {
zr.TBegin(t)
// replaceLines(
// lines []string,
// finds [][]string,
// repls [][]string,
// caseMode zr.CaseMode,
// ) (changedLines []string, changes int)
//
test := func(
// in:
lines []string,
finds [][]string,
repls [][]string,
caseMode zr.CaseMode,
// out expected:
changedLines []string,
changes int, //
) {
changedLinesT, changesT := replaceLines(
lines, finds, repls, caseMode,
)
zr.TEqual(t, changedLinesT, (changedLines))
zr.TEqual(t, changesT, (changes))
}
test(
[]string{}, [][]string{}, [][]string{}, zr.MatchCase,
// out:
[]string{}, 0,
)
}
// end