fancy docs and 100% coverage

This commit is contained in:
Gregory Roseberry 2014-08-29 10:50:02 +09:00
parent d46826878c
commit 705af58a4d
2 changed files with 13 additions and 0 deletions

View file

@ -1,3 +1,4 @@
## null [![GoDoc](https://godoc.org/github.com/guregu/null?status.svg)](https://godoc.org/github.com/guregu/null) [![Coverage](http://gocover.io/_badge/github.com/guregu/null)](http://gocover.io/github.com/guregu/null)
null is a library with opinions on how to deal with nullable SQL and JSON values
### String

View file

@ -46,6 +46,18 @@ func TestUnmarshalString(t *testing.T) {
assertNull(t, null, "null json")
}
func TestTextUnmarshalString(t *testing.T) {
var str String
err := str.UnmarshalText([]byte("test"))
maybePanic(err)
assert(t, str, "TextUnmarshal() string")
var null String
err = null.UnmarshalText([]byte(""))
maybePanic(err)
assertNull(t, null, "TextUnmarshal() empty string")
}
func TestMarshalString(t *testing.T) {
str := StringFrom("test")
data, err := json.Marshal(str)