File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ import (
20
20
"testing"
21
21
)
22
22
23
+ var InvalidValue = struct {}{}
24
+
23
25
func TestValueLess (t * testing.T ) {
24
26
table := []struct {
25
27
name string
@@ -29,6 +31,39 @@ func TestValueLess(t *testing.T) {
29
31
eq bool
30
32
}{
31
33
{
34
+ name : "Invalid-1" ,
35
+ a : InvalidValue ,
36
+ b : InvalidValue ,
37
+ eq : true ,
38
+ }, {
39
+ name : "Invalid-2" ,
40
+ a : 1. ,
41
+ b : InvalidValue ,
42
+ }, {
43
+ name : "Invalid-3" ,
44
+ a : 1 ,
45
+ b : InvalidValue ,
46
+ }, {
47
+ name : "Invalid-4" ,
48
+ a : "aoeu" ,
49
+ b : InvalidValue ,
50
+ }, {
51
+ name : "Invalid-5" ,
52
+ a : true ,
53
+ b : InvalidValue ,
54
+ }, {
55
+ name : "Invalid-6" ,
56
+ a : []interface {}{},
57
+ b : InvalidValue ,
58
+ }, {
59
+ name : "Invalid-7" ,
60
+ a : map [string ]interface {}{},
61
+ b : InvalidValue ,
62
+ }, {
63
+ name : "Invalid-8" ,
64
+ a : nil ,
65
+ b : InvalidValue ,
66
+ }, {
32
67
name : "Float-1" ,
33
68
a : 1.14 ,
34
69
b : 3.14 ,
Original file line number Diff line number Diff line change 31
31
writePool = jsoniter .NewStream (jsoniter .ConfigCompatibleWithStandardLibrary , nil , 1024 ).Pool ()
32
32
)
33
33
34
- // A Value corresponds to an 'atom' in the schema.
34
+ // A Value corresponds to an 'atom' in the schema. It should return true
35
+ // for at least one of the IsXXX methods below, or the value is
36
+ // considered "invalid"
35
37
type Value interface {
36
38
// IsMap returns true if the Value is a Map, false otherwise.
37
39
IsMap () bool
You can’t perform that action at this time.
0 commit comments