-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathveil_string_test.go
65 lines (48 loc) · 1.4 KB
/
veil_string_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
package veil_test
import (
"fmt"
"testing"
"github.com/kosatnkn/veil"
)
// TestStringObscure tests for the data obscure action performed against given string.
func TestStringObscure(t *testing.T) {
// define rules
var rules []veil.Rule
rules = append(rules, veil.NewRule("number", veil.PatternNumber, veil.ActionObscureFunc))
// create new veil instance
v, _ := veil.NewVeil(rules)
// input data
d := getInputData()
fmt.Printf("Data: %#v\n", d)
// process
o, _ := v.Process(d...)
fmt.Printf("Output: %#v\n", o)
}
// TestStringMask tests for the data mask action performed against given string.
func TestStringMask(t *testing.T) {
// define rules
var rules []veil.Rule
rules = append(rules, veil.NewRule("number", veil.PatternNumber, veil.ActionMaskFunc))
// create new veil instance
v, _ := veil.NewVeil(rules)
// input data
d := getInputData()
fmt.Printf("Data: %#v\n", d)
// process
o, _ := v.Process(d...)
fmt.Printf("Output: %#v\n", o)
}
// TestStringer tests for the use of the stringer interface if it is implemented.
func TestStringer(t *testing.T) {
// define rules
var rules []veil.Rule
rules = append(rules, veil.NewRule("number", veil.PatternNumber, veil.ActionMaskFunc))
// create new veil instance
v, _ := veil.NewVeil(rules)
// input data
d := getInputDataStringer()
fmt.Printf("Data: %#v\n", d)
// process
o, _ := v.Process(d...)
fmt.Printf("Output: %#v\n", o)
}