mirror of
https://github.com/jackc/pgx.git
synced 2025-05-27 17:52:08 +00:00
Add test documenting typed nil json encoding
Encoded into json null not SQL NULL.
This commit is contained in:
parent
0355d2ffea
commit
288080c58c
@ -48,6 +48,8 @@ func TestJSONCodec(t *testing.T) {
|
||||
{map[string]interface{}{"foo": "bar"}, new(map[string]interface{}), isExpectedEqMap(map[string]interface{}{"foo": "bar"})},
|
||||
{jsonStruct{Name: "Adam", Age: 10}, new(jsonStruct), isExpectedEq(jsonStruct{Name: "Adam", Age: 10})},
|
||||
{nil, new(*jsonStruct), isExpectedEq((*jsonStruct)(nil))},
|
||||
{map[string]interface{}(nil), new(string), isExpectedEq(`null`)},
|
||||
{map[string]interface{}(nil), new([]byte), isExpectedEqBytes([]byte("null"))},
|
||||
{[]byte(nil), new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
{nil, new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
})
|
||||
|
@ -21,6 +21,8 @@ func TestJSONBTranscode(t *testing.T) {
|
||||
{map[string]interface{}{"foo": "bar"}, new(map[string]interface{}), isExpectedEqMap(map[string]interface{}{"foo": "bar"})},
|
||||
{jsonStruct{Name: "Adam", Age: 10}, new(jsonStruct), isExpectedEq(jsonStruct{Name: "Adam", Age: 10})},
|
||||
{nil, new(*jsonStruct), isExpectedEq((*jsonStruct)(nil))},
|
||||
{map[string]interface{}(nil), new(string), isExpectedEq(`null`)},
|
||||
{map[string]interface{}(nil), new([]byte), isExpectedEqBytes([]byte("null"))},
|
||||
{[]byte(nil), new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
{nil, new([]byte), isExpectedEqBytes([]byte(nil))},
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user