| 1 | package encodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/ |
| 2 | |
| 3 | import ( |
| 4 | "errorsscip-go gomod github.com/golang/go/src go1.14 errors/" |
| 5 | "imagescip-go gomod github.com/golang/go/src go1.14 image/" |
| 6 | "reflectscip-go gomod github.com/golang/go/src go1.14 reflect/" |
| 7 | "testingscip-go gomod github.com/golang/go/src go1.14 testing/" |
| 8 | "timescip-go gomod github.com/golang/go/src go1.14 time/" |
| 9 | ) |
| 10 | |
| 11 | var encodeExpectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/encodeExpected. = map[string]interface{}{ |
| 12 | "Level0": int64(1), |
| 13 | "Level1b": int64(2), |
| 14 | "Level1c": int64(3), |
| 15 | "Level1a": int64(5), |
| 16 | "LEVEL1B": int64(6), |
| 17 | "e": map[string]interface{}{ |
| 18 | "Level1a": int64(8), |
| 19 | "Level1b": int64(9), |
| 20 | "Level1c": int64(10), |
| 21 | "Level1d": int64(11), |
| 22 | "x": int64(12), |
| 23 | }, |
| 24 | "Loop1": int64(13), |
| 25 | "Loop2": int64(14), |
| 26 | "X": int64(15), |
| 27 | "Y": int64(16), |
| 28 | "Z": int64(17), |
| 29 | } |
| 30 | |
| 31 | func TestEncodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncode().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 32 | // Top is defined in decoder_test.go |
| 33 | var in = Topscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#{ |
| 34 | Level0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#Level0.: 1, |
| 35 | Embed0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#Embed0.: Embed0scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#{ |
| 36 | Level1bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#Level1b.: 2, |
| 37 | Level1cscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#Level1c.: 3, |
| 38 | }, |
| 39 | Embed0ascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#Embed0a.: &Embed0ascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0a#{ |
| 40 | Level1ascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0a#Level1a.: 5, |
| 41 | Level1bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0a#Level1b.: 6, |
| 42 | }, |
| 43 | Embed0bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#Embed0b.: &Embed0bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0b#{ |
| 44 | Level1ascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#Level1a.: 8, |
| 45 | Level1bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#Level1b.: 9, |
| 46 | Level1cscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#Level1c.: 10, |
| 47 | Level1dscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#Level1d.: 11, |
| 48 | Level1escip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0#Level1e.: 12, |
| 49 | }, |
| 50 | Loopscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#Loop.: Loopscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Loop#{ |
| 51 | Loop1scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Loop#Loop1.: 13, |
| 52 | Loop2scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Loop#Loop2.: 14, |
| 53 | }, |
| 54 | Embed0pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#Embed0p.: Embed0pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0p#{ |
| 55 | Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0p#Point.: imagescip-go gomod github.com/golang/go/src go1.14 image/.Pointscip-go gomod github.com/golang/go/src go1.14 image/Point#{Xscip-go gomod github.com/golang/go/src go1.14 image/Point#X.: 15, Yscip-go gomod github.com/golang/go/src go1.14 image/Point#Y.: 16}, |
| 56 | }, |
| 57 | Embed0qscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Top#Embed0q.: Embed0qscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0q#{ |
| 58 | Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Embed0q#Point.: Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#{Zscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#Z.: 17}, |
| 59 | }, |
| 60 | } |
| 61 | |
| 62 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(&in) |
| 63 | if err != nil { |
| 64 | t.Fatalscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatal().(err) |
| 65 | } |
| 66 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, encodeExpectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/encodeExpected.) { |
| 67 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().(" got: %v\nwant: %v\n", got, encodeExpectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/encodeExpected.) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | type Optionalsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals# struct { |
| 72 | Srscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Sr. string `rethinkdb:"sr"` |
| 73 | Soscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#So. string `rethinkdb:"so,omitempty"` |
| 74 | Swscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Sw. string `rethinkdb:"-"` |
| 75 | |
| 76 | Irscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Ir. int `rethinkdb:"omitempty"` // actually named omitempty, not an option |
| 77 | Ioscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Io. int `rethinkdb:"io,omitempty"` |
| 78 | |
| 79 | Trscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Tr. timescip-go gomod github.com/golang/go/src go1.14 time/.Timescip-go gomod github.com/golang/go/src go1.14 time/Time# `rethinkdb:"tr"` |
| 80 | Toscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#To. timescip-go gomod github.com/golang/go/src go1.14 time/.Timescip-go gomod github.com/golang/go/src go1.14 time/Time# `rethinkdb:"to,omitempty"` |
| 81 | |
| 82 | Slrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Slr. []string `rethinkdb:"slr"` |
| 83 | Sloscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Slo. []string `rethinkdb:"slo,omitempty"` |
| 84 | |
| 85 | Mrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Mr. map[string]interface{} `rethinkdb:"mr"` |
| 86 | Moscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Mo. map[string]interface{} `rethinkdb:",omitempty"` |
| 87 | } |
| 88 | |
| 89 | var optionalsExpectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/optionalsExpected. = map[string]interface{}{ |
| 90 | "sr": "", |
| 91 | "omitempty": int64(0), |
| 92 | "tr": map[string]interface{}{"$reql_type$": "TIME", "epoch_time": 0, "timezone": "+00:00"}, |
| 93 | "slr": []interface{}(nil), |
| 94 | "mr": map[string]interface{}{}, |
| 95 | } |
| 96 | |
| 97 | func TestOmitEmptyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestOmitEmpty().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 98 | var o Optionalsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals# |
| 99 | o.Swscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Sw. = "something" |
| 100 | o.Trscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Tr. = timescip-go gomod github.com/golang/go/src go1.14 time/.Unixscip-go gomod github.com/golang/go/src go1.14 time/Unix().(0, 0).Inscip-go gomod github.com/golang/go/src go1.14 time/Time#In().(timescip-go gomod github.com/golang/go/src go1.14 time/.UTCscip-go gomod github.com/golang/go/src go1.14 time/UTC.) |
| 101 | o.Mrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Mr. = map[string]interface{}{} |
| 102 | o.Moscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Optionals#Mo. = map[string]interface{}{} |
| 103 | |
| 104 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(&o) |
| 105 | if err != nil { |
| 106 | t.Fatalscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatal().(err) |
| 107 | } |
| 108 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(got, optionalsExpectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/optionalsExpected.) { |
| 109 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("\ngot: %#v\nwant: %#v\n", got, optionalsExpectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/optionalsExpected.) |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | type IntTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/IntType# int |
| 114 | |
| 115 | type MyStructscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/MyStruct# struct { |
| 116 | IntTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/MyStruct#IntType. |
| 117 | } |
| 118 | |
| 119 | func TestAnonymousNonstructscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestAnonymousNonstruct().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 120 | var i IntTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/IntType# = 11 |
| 121 | a := MyStructscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/MyStruct#{i} |
| 122 | var want = map[string]interface{}{"IntType": int64(11)} |
| 123 | |
| 124 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(a) |
| 125 | if err != nil { |
| 126 | t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("Encode: %v", err) |
| 127 | } |
| 128 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, want) { |
| 129 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %v, want %v", got, want) |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | func TestEncodePointerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodePointer().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 134 | v := Pointerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Pointer#{PPointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Pointer#PPoint.: &Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#{Zscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#Z.: 1}, Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Pointer#Point.: Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#{Zscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#Z.: 2}} |
| 135 | var want = map[string]interface{}{ |
| 136 | "PPoint": map[string]interface{}{"Z": int64(1)}, |
| 137 | "Point": map[string]interface{}{"Z": int64(2)}, |
| 138 | } |
| 139 | |
| 140 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(v) |
| 141 | if err != nil { |
| 142 | t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("Encode: %v", err) |
| 143 | } |
| 144 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, want) { |
| 145 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %v, want %v", got, want) |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | func TestEncodeNilPointerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeNilPointer().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 150 | v := Pointerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Pointer#{PPointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Pointer#PPoint.: nil, Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Pointer#Point.: Pointscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#{Zscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Point#Z.: 2}} |
| 151 | var want = map[string]interface{}{ |
| 152 | "PPoint": nil, |
| 153 | "Point": map[string]interface{}{"Z": int64(2)}, |
| 154 | } |
| 155 | |
| 156 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(v) |
| 157 | if err != nil { |
| 158 | t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("Encode: %v", err) |
| 159 | } |
| 160 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, want) { |
| 161 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %v, want %v", got, want) |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | type BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugA# struct { |
| 166 | Sscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugA#S. string |
| 167 | } |
| 168 | |
| 169 | type BugBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugB# struct { |
| 170 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugB#BugA. |
| 171 | Sscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugB#S. string |
| 172 | } |
| 173 | |
| 174 | type BugCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugC# struct { |
| 175 | Sscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugC#S. string |
| 176 | } |
| 177 | |
| 178 | // Legal Go: We never use the repeated embedded field (S). |
| 179 | type BugXscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugX# struct { |
| 180 | Ascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugX#A. int |
| 181 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugX#BugA. |
| 182 | BugBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugX#BugB. |
| 183 | } |
| 184 | |
| 185 | // Issue 5245. |
| 186 | func TestEmbeddedBugscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEmbeddedBug().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 187 | v := BugBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugB#{ |
| 188 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugA#{"A"}, |
| 189 | "B", |
| 190 | } |
| 191 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(v) |
| 192 | if err != nil { |
| 193 | t.Fatalscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatal().("Encode:", err) |
| 194 | } |
| 195 | want := map[string]interface{}{"S": "B"} |
| 196 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, want) { |
| 197 | t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("Encode: got %v want %v", got, want) |
| 198 | } |
| 199 | // Now check that the duplicate field, S, does not appear. |
| 200 | x := BugXscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugX#{ |
| 201 | Ascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugX#A.: 23, |
| 202 | } |
| 203 | got, err = Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(x) |
| 204 | if err != nil { |
| 205 | t.Fatalscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatal().("Encode:", err) |
| 206 | } |
| 207 | want = map[string]interface{}{"A": int64(23)} |
| 208 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, want) { |
| 209 | t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("Encode: got %v want %v", got, want) |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | type BugDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugD# struct { // Same as BugA after tagging. |
| 214 | XXXscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugD#XXX. string `rethinkdb:"S"` |
| 215 | } |
| 216 | |
| 217 | // BugD's tagged S field should dominate BugA's. |
| 218 | type BugYscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugY# struct { |
| 219 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugY#BugA. |
| 220 | BugDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugY#BugD. |
| 221 | } |
| 222 | |
| 223 | // Test that a field with a tag dominates untagged fields. |
| 224 | func TestTaggedFieldDominatesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestTaggedFieldDominates().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 225 | v := BugYscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugY#{ |
| 226 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugA#{"BugA"}, |
| 227 | BugDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugD#{"BugD"}, |
| 228 | } |
| 229 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(v) |
| 230 | if err != nil { |
| 231 | t.Fatalscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatal().("Encode:", err) |
| 232 | } |
| 233 | want := map[string]interface{}{"S": "BugD"} |
| 234 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, want) { |
| 235 | t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("Encode: got %v want %v", got, want) |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | // There are no tags here, so S should not appear. |
| 240 | type BugZscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugZ# struct { |
| 241 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugZ#BugA. |
| 242 | BugCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugZ#BugC. |
| 243 | BugYscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugZ#BugY. // Contains a tagged S field through BugD; should not dominate. |
| 244 | } |
| 245 | |
| 246 | func TestDuplicatedFieldDisappearsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestDuplicatedFieldDisappears().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 247 | v := BugZscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugZ#{ |
| 248 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugA#{"BugA"}, |
| 249 | BugCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugC#{"BugC"}, |
| 250 | BugYscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugY#{ |
| 251 | BugAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugA#{"nested BugA"}, |
| 252 | BugDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/BugD#{"nested BugD"}, |
| 253 | }, |
| 254 | } |
| 255 | got, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(v) |
| 256 | if err != nil { |
| 257 | t.Fatalscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatal().("Encode:", err) |
| 258 | } |
| 259 | want := map[string]interface{}{} |
| 260 | if !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(got, want) { |
| 261 | t.Fatalfscip-go gomod github.com/golang/go/src go1.14 testing/common#Fatalf().("Encode: got %v want %v", got, want) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func TestEncodeMapIntKeysscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeMapIntKeys().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 266 | input := map[int]int{1: 1, 2: 2, 3: 3} |
| 267 | want := map[string]int{"1": 1, "2": 2, "3": 3} |
| 268 | |
| 269 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 270 | if err != nil { |
| 271 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 272 | } |
| 273 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 274 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | type RefAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefA# struct { |
| 279 | IDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefA#ID. string `rethinkdb:"id,omitempty"` |
| 280 | Bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefA#B. *RefBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB# `rethinkdb:"b_id,reference" rethinkdb_ref:"id"` |
| 281 | } |
| 282 | |
| 283 | type RefBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB# struct { |
| 284 | IDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB#ID. string `rethinkdb:"id,omitempty"` |
| 285 | Namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB#Name. string `rethinkdb:"name"` |
| 286 | } |
| 287 | |
| 288 | func TestReferenceFieldscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestReferenceField().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 289 | input := RefAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefA#{"1", &RefBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB#{"2", "Name"}} |
| 290 | want := map[string]interface{}{"id": "1", "b_id": "2"} |
| 291 | |
| 292 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 293 | if err != nil { |
| 294 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 295 | } |
| 296 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 297 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | type RefCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefC# struct { |
| 302 | IDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefC#ID. string `rethinkdb:"id,omitempty"` |
| 303 | Bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefC#B. *RefBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB# `rethinkdb:"b_id,reference" rethinkdb_ref:"b_id"` |
| 304 | } |
| 305 | |
| 306 | func TestReferenceFieldMissingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestReferenceFieldMissing().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 307 | input := RefCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefC#{"1", &RefBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB#{"2", "Name"}} |
| 308 | |
| 309 | _, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 310 | if err == nil { |
| 311 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("expected non-nil error but got nil") |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | type RefDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefD# struct { |
| 316 | IDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefD#ID. string `rethinkdb:"id,omitempty"` |
| 317 | Bscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefD#B. string `rethinkdb:"b_id,reference" rethinkdb_ref:"b_id"` |
| 318 | } |
| 319 | |
| 320 | func TestReferenceFieldInvalidscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestReferenceFieldInvalid().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 321 | input := RefDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefD#{"1", "B"} |
| 322 | |
| 323 | _, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 324 | if err == nil { |
| 325 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("expected non-nil error but got nil") |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | type RefEscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefE# struct { |
| 330 | IDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefE#ID. string `rethinkdb:"id,omitempty"` |
| 331 | FIDsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefE#FIDs. *[]RefFscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefF# `rethinkdb:"f_ids,reference" rethinkdb_ref:"id"` |
| 332 | } |
| 333 | |
| 334 | type RefFscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefF# struct { |
| 335 | IDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefF#ID. string `rethinkdb:"id,omitempty"` |
| 336 | Namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefF#Name. string `rethinkdb:"name"` |
| 337 | } |
| 338 | |
| 339 | func TestReferenceFieldArrayscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestReferenceFieldArray().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 340 | input := RefEscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefE#{"1", &[]RefFscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefF#{RefFscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefF#{"2", "Name2"}, RefFscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefF#{"3", "Name3"}}} |
| 341 | want := map[string]interface{}{"id": "1", "f_ids": []string{"2", "3"}} |
| 342 | |
| 343 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 344 | if err != nil { |
| 345 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 346 | } |
| 347 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 348 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | func TestEncodeBytesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeBytes().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 353 | type BytesStruct struct { |
| 354 | A []byte |
| 355 | B [1]byte |
| 356 | } |
| 357 | |
| 358 | input := BytesStruct{[]byte("A"), [1]byte{'B'}} |
| 359 | want := map[string]interface{}{ |
| 360 | "A": map[string]interface{}{"$reql_type$": "BINARY", "data": "QQ=="}, |
| 361 | "B": map[string]interface{}{"$reql_type$": "BINARY", "data": "Qg=="}, |
| 362 | } |
| 363 | |
| 364 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 365 | if err != nil { |
| 366 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 367 | } |
| 368 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 369 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | type Compoundscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Compound# struct { |
| 374 | PartAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Compound#PartA. string `rethinkdb:"id[0]"` |
| 375 | PartBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Compound#PartB. string `rethinkdb:"id[1]"` |
| 376 | ErrAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Compound#ErrA. string `rethinkdb:"err_a[]"` |
| 377 | ErrBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Compound#ErrB. string `rethinkdb:"err_b["` |
| 378 | ErrCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Compound#ErrC. string `rethinkdb:"err_c]"` |
| 379 | } |
| 380 | |
| 381 | func TestEncodeCompoundscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeCompound().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 382 | input := Compoundscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Compound#{"1", "2", "3", "4", "5"} |
| 383 | want := map[string]interface{}{"id": []string{"1", "2"}, "err_a[]": "3", "err_b[": "4", "err_c]": "5"} |
| 384 | |
| 385 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 386 | if err != nil { |
| 387 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 388 | } |
| 389 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 390 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | type CompoundRefscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/CompoundRef# struct { |
| 395 | PartAscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/CompoundRef#PartA. string `rethinkdb:"id[0]"` |
| 396 | PartBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/CompoundRef#PartB. *RefBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB# `rethinkdb:"id[1],reference" rethinkdb_ref:"id"` |
| 397 | } |
| 398 | |
| 399 | func TestEncodeCompoundRefscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeCompoundRef().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 400 | input := CompoundRefscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/CompoundRef#{"1", &RefBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/RefB#{"2", "Name"}} |
| 401 | want := map[string]interface{}{"id": []string{"1", "2"}} |
| 402 | |
| 403 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 404 | if err != nil { |
| 405 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 406 | } |
| 407 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 408 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | func TestEncodeNilSlicescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeNilSlice().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 413 | input := SliceStructscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/SliceStruct#{} |
| 414 | want := map[string]interface{}{"X": []string(nil)} |
| 415 | |
| 416 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(input) |
| 417 | if err != nil { |
| 418 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 419 | } |
| 420 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 421 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 422 | } |
| 423 | } |
| 424 | |
| 425 | func TestEncodeCustomTypeEncodingValuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeCustomTypeEncodingValue().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 426 | type innerType struct { |
| 427 | Val int |
| 428 | } |
| 429 | |
| 430 | outer := struct { |
| 431 | Inner innerType `rethinkdb:"inner"` |
| 432 | }{Inner: innerType{Val: 5}} |
| 433 | want := map[string]interface{}{ |
| 434 | "inner": map[string]interface{}{ |
| 435 | "someval": 5, |
| 436 | }, |
| 437 | } |
| 438 | |
| 439 | SetTypeEncodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/SetTypeEncoding().(reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.14 reflect/TypeOf().(innerType{}), |
| 440 | func(v interface{}) (interface{}, error) { |
| 441 | return map[string]interface{}{"someval": v.(innerType).Val}, nil |
| 442 | }, nil) |
| 443 | |
| 444 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(outer) |
| 445 | if err != nil { |
| 446 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 447 | } |
| 448 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 449 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | func TestEncodeCustomTypeEncodingPointerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeCustomTypeEncodingPointer().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 454 | type innerType struct { |
| 455 | Val int |
| 456 | } |
| 457 | |
| 458 | outer := struct { |
| 459 | Inner *innerType `rethinkdb:"inner"` |
| 460 | }{Inner: &innerType{Val: 5}} |
| 461 | want := map[string]interface{}{ |
| 462 | "inner": map[string]interface{}{ |
| 463 | "someval": 5, |
| 464 | }, |
| 465 | } |
| 466 | |
| 467 | SetTypeEncodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/SetTypeEncoding().(reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.14 reflect/TypeOf().((*innerType)(nil)), |
| 468 | func(v interface{}) (interface{}, error) { |
| 469 | return map[string]interface{}{"someval": v.(*innerType).Val}, nil |
| 470 | }, nil) |
| 471 | |
| 472 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(outer) |
| 473 | if err != nil { |
| 474 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 475 | } |
| 476 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 477 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | func TestEncodeCustomRootTypeEncodingValuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeCustomRootTypeEncodingValue().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 482 | type cType struct { |
| 483 | Val int |
| 484 | } |
| 485 | in := cType{Val: 5} |
| 486 | |
| 487 | want := map[string]interface{}{ |
| 488 | "someval": 5, |
| 489 | } |
| 490 | |
| 491 | SetTypeEncodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/SetTypeEncoding().(reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.14 reflect/TypeOf().(cType{}), |
| 492 | func(v interface{}) (interface{}, error) { |
| 493 | return map[string]interface{}{"someval": v.(cType).Val}, nil |
| 494 | }, nil) |
| 495 | |
| 496 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(in) |
| 497 | if err != nil { |
| 498 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 499 | } |
| 500 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 501 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | func TestEncodeCustomRootTypeEncodingPointerscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeCustomRootTypeEncodingPointer().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 506 | type cType struct { |
| 507 | Val int |
| 508 | } |
| 509 | in := cType{Val: 5} |
| 510 | |
| 511 | want := map[string]interface{}{ |
| 512 | "someval": 5, |
| 513 | } |
| 514 | |
| 515 | SetTypeEncodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/SetTypeEncoding().(reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.14 reflect/TypeOf().((*cType)(nil)), |
| 516 | func(v interface{}) (interface{}, error) { |
| 517 | return map[string]interface{}{"someval": v.(*cType).Val}, nil |
| 518 | }, nil) |
| 519 | |
| 520 | out, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(&in) |
| 521 | if err != nil { |
| 522 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got error %v, expected nil", err) |
| 523 | } |
| 524 | if !jsonEqualscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/jsonEqual().(out, want) { |
| 525 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", out, want) |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | func TestEncodeCustomRootTypeEncodingErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/TestEncodeCustomRootTypeEncodingError().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 530 | type cType struct { |
| 531 | Val int |
| 532 | } |
| 533 | in := cType{Val: 5} |
| 534 | |
| 535 | cerr := errorsscip-go gomod github.com/golang/go/src go1.14 errors/.Newscip-go gomod github.com/golang/go/src go1.14 errors/New().("encode error") |
| 536 | |
| 537 | SetTypeEncodingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/SetTypeEncoding().(reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.14 reflect/TypeOf().((*cType)(nil)), |
| 538 | func(v interface{}) (interface{}, error) { |
| 539 | return nil, cerr |
| 540 | }, nil) |
| 541 | |
| 542 | _, err := Encodescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/encoding`/Encode().(&in) |
| 543 | if err == nil { |
| 544 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got nil error, expected %v", cerr) |
| 545 | } |
| 546 | if err != cerr { |
| 547 | t.Errorfscip-go gomod github.com/golang/go/src go1.14 testing/common#Errorf().("got %q, want %q", err, cerr) |
| 548 | } |
| 549 | } |