-
Notifications
You must be signed in to change notification settings - Fork 0
/
nis_test.go
65 lines (58 loc) · 1.52 KB
/
nis_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 dirsyn
import "testing"
func TestNetgroupTriple(t *testing.T) {
var r RFC2307
for idx, raw := range []string{
`(console,jc,example.com)`,
`(-,-,-)`,
`("","","")`,
`(-,jc,-)`,
} {
if trip, err := r.NetgroupTriple(raw); err != nil {
t.Errorf("%s[%d] failed: %v", t.Name(), idx, err)
} else if got := trip.String(); got != raw {
t.Errorf("%s[%d] failed:\nwant: %s\ngot: %s",
t.Name(), idx, raw, got)
}
}
ngt := NetgroupTriple{}
_ = ngt.String()
ngt.setNetgroupTripleFieldByIndex(0, nil)
ngt.setNetgroupTripleFieldByIndex(0, ``)
ngt.setNetgroupTripleFieldByIndex(0, `this`)
ngt.setNetgroupTripleFieldByIndex(1, IA5String(`isOnly`))
ngt.setNetgroupTripleFieldByIndex(2, IA5String(`aTest`))
_ = ngt.String()
r.NetgroupTriple(`(?,?,?,?)`)
r.NetgroupTriple(`??`)
r.NetgroupTriple(`(??`)
r.NetgroupTriple(nil)
r.NetgroupTriple(`ÃÃ"","","",""`)
r.NetgroupTriple(`@,\,"","Ã"`)
}
func TestBootParameter(t *testing.T) {
var r RFC2307
for idx, raw := range []string{
`test=thing:path`,
} {
if btp, err := r.BootParameter(raw); err != nil {
t.Errorf("%s[%d] failed: %v", t.Name(), idx, err)
} else if got := btp.String(); got != raw {
t.Errorf("%s[%d] failed:\nwant: %s\ngot: %s",
t.Name(), idx, raw, got)
}
}
r.BootParameter(`test=`)
r.BootParameter(`test=;:`)
r.BootParameter(`test:`)
r.BootParameter(``)
r.BootParameter(nil)
}
func TestNIS_codecov(t *testing.T) {
isKeystring(`c--l`)
isKeystring(`-`)
isKeystring(``)
isKeystring(`c界j`)
isKeystring(`A`)
isKeystring(`abc`)
}