Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
usk81 committed Jul 19, 2018
1 parent 47ae6ac commit 7f456b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
16 changes: 16 additions & 0 deletions type_string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 14,22 @@ type TestStringStruct struct {
NullValue String `json:"null_value"`
}

func TestMarshalString(t *testing.T) {
expected := String{
ValidFlag: true,
string: "foobar",
}

s := "foobar"
actual, err := MarshalString(s)
if err != nil {
t.Errorf("Not Expected error when MarshalString. error:%v", err.Error())
}
if actual != expected {
t.Errorf("actual:%v, expected:%v", actual, expected)
}
}

func TestStringJsonUnmarshalAndMarshal(t *testing.T) {
var ts TestStringStruct
jstr := `{"int":10,"float":1.1,"bool":false,"string":"qwertyuiopkjhgv876","html":"https://golang.org/src/encoding/json/encode.go?h=float64Encoder&foo=bar#L409","null_value":null}`
Expand Down
2 changes: 1 addition & 1 deletion type_time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 47,7 @@ func TestTimeJsonUnmarshal(t *testing.T) {
if !tt.Valid() {
t.Error("ValidFlag should be TRUE")
}
if tt.Time().String() != v.String() {
if tt.Time().Format(time.RFC3339) != v.Format(time.RFC3339) {
t.Errorf("actual:%v, expected:%v", tt.Time(), v)
}
}
Expand Down
2 changes: 1 addition & 1 deletion type_timestamp_nanoseconds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 90,7 @@ func TestTimestampNanoSetTime(t *testing.T) {
t.Errorf("Not Expected error. error:%s", err.Error())
}
if tn.Weak() != expected.UnixNano() {
t.Errorf("actual:%d, expected:%d", tn.Weak(), expected)
t.Errorf("actual:%v, expected:%v", tn.Weak(), expected)
}
}

Expand Down

0 comments on commit 7f456b1

Please sign in to comment.