-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathvaluedecoder_test.go
More file actions
63 lines (53 loc) · 1.36 KB
/
valuedecoder_test.go
File metadata and controls
63 lines (53 loc) · 1.36 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
package urlquery
import (
"reflect"
"testing"
)
func Test_boolDecode_Error(t *testing.T) {
_, err := boolDecode("d-22")
if _, ok := err.(ErrTranslated); !ok {
t.Error("unexpected error type")
}
}
func Test_baseIntDecode_Error(t *testing.T) {
_, err := baseIntDecode("d2", 8)
if _, ok := err.(ErrTranslated); !ok {
t.Error("unexpected error type")
}
_, err1 := baseIntDecode("2", 23)
if _, ok := err1.(ErrUnsupportedBitSize); !ok {
t.Error("unexpected error type")
}
}
func Test_baseUintDecode_Error(t *testing.T) {
_, err := baseUintDecode("d2", 8)
if _, ok := err.(ErrTranslated); !ok {
t.Error("unexpected error type")
}
_, err1 := baseUintDecode("2", 23)
if _, ok := err1.(ErrUnsupportedBitSize); !ok {
t.Error("unexpected error type")
}
}
func Test_baseFloatDecode_Error(t *testing.T) {
_, err := baseFloatDecode("d2.2", 32)
if _, ok := err.(ErrTranslated); !ok {
t.Error("unexpected error type")
}
_, err1 := baseFloatDecode("2.2", 63)
if _, ok := err1.(ErrUnsupportedBitSize); !ok {
t.Error("unexpected error type")
}
}
func Test_baseUintPrtDecode_Error(t *testing.T) {
_, err := uintPrtDecode("d2")
if _, ok := err.(ErrTranslated); !ok {
t.Error("unexpected error type")
}
}
func Test_getDecodeFunc_Nil(t *testing.T) {
v := getDecodeFunc(reflect.Chan)
if v != nil {
t.Error("getDecodeFunc of reflect.Chan should return nil")
}
}