MCPcopy Create free account
hub / github.com/dinedal/textql / TestNull

Function TestNull

sqlparser/sqltypes/type_test.go:13–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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
39func TestNumeric(t *testing.T) {
40 n := Value{Numeric([]byte("1234"))}

Callers

nothing calls this directly

Calls 5

IsNullMethod · 0.95
StringMethod · 0.95
EncodeSqlMethod · 0.95
EncodeAsciiMethod · 0.95
MarshalJSONMethod · 0.95

Tested by

no test coverage detected