(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestNull(t *testing.T) { |
| 14 | n := Value{} |
| 15 | if !n.IsNull() { |
| 16 | t.Errorf("value is not null") |
| 17 | } |
| 18 | if n.String() != "" { |
| 19 | t.Errorf("Expecting '', got %s", n.String()) |
| 20 | } |
| 21 | b := bytes.NewBuffer(nil) |
| 22 | n.EncodeSql(b) |
| 23 | if b.String() != "null" { |
| 24 | t.Errorf("Expecting null, got %s", b.String()) |
| 25 | } |
| 26 | n.EncodeAscii(b) |
| 27 | if b.String() != "nullnull" { |
| 28 | t.Errorf("Expecting nullnull, got %s", b.String()) |
| 29 | } |
| 30 | js, err := n.MarshalJSON() |
| 31 | if err != nil { |
| 32 | t.Errorf("Unexpected error: %s", err) |
| 33 | } |
| 34 | if string(js) != "null" { |
| 35 | t.Errorf("Expecting null, received %s", js) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func TestNumeric(t *testing.T) { |
| 40 | n := Value{Numeric([]byte("1234"))} |
nothing calls this directly
no test coverage detected