sum7/warehost
sum7
/
warehost
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
warehost/lib/data/main_test.go

31 lines
577 B
Go

package data
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSQL(t *testing.T) {
assert := assert.New(t)
a := JsonNullInt64{}
a.Scan(300)
assert.Equal(int64(300), a.Int64)
a.UnmarshalJSON([]byte{'2', '3'})
assert.Equal(int64(23), a.Int64)
err := a.UnmarshalJSON([]byte{})
assert.Error(err)
a.UnmarshalJSON([]byte{'n', 'u', 'l', 'l'})
assert.False(a.Valid)
value, _ := a.MarshalJSON()
assert.Equal([]byte{'n', 'u', 'l', 'l'}, value)
a.UnmarshalJSON([]byte{'1', '4'})
value, _ = a.MarshalJSON()
assert.Equal([]byte{'1', '4'}, value)
}