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 (
2020 "testing"
2121)
2222
23+ var InvalidValue = struct {}{}
24+
2325func TestValueLess (t * testing.T ) {
2426 table := []struct {
2527 name string
@@ -29,6 +31,39 @@ func TestValueLess(t *testing.T) {
2931 eq bool
3032 }{
3133 {
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+ }, {
3267 name : "Float-1" ,
3368 a : 1.14 ,
3469 b : 3.14 ,
Original file line number Diff line number Diff line change 3131 writePool = jsoniter .NewStream (jsoniter .ConfigCompatibleWithStandardLibrary , nil , 1024 ).Pool ()
3232)
3333
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"
3537type Value interface {
3638 // IsMap returns true if the Value is a Map, false otherwise.
3739 IsMap () bool
You can’t perform that action at this time.
0 commit comments