1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-21 19:20:05 -05:00

Add tests for String/Boolean String() methods

This commit is contained in:
Aaron Lindsay 2021-10-17 21:44:42 -04:00
parent 09f161e13e
commit 5ed0050aad

View File

@ -316,6 +316,13 @@ func TestUnmarshalString(t *testing.T) {
unmarshalHelper(t, "Some Name\n ", &s, &overwritten) unmarshalHelper(t, "Some Name\n ", &s, &overwritten)
} }
func TestStringString(t *testing.T) {
var s String = "foobar"
if s.String() != "foobar" {
t.Fatalf("Unexpected result when returning String.String(): %s\n", s.String())
}
}
func TestMarshalBoolean(t *testing.T) { func TestMarshalBoolean(t *testing.T) {
var b Boolean = true var b Boolean = true
marshalHelper(t, "Y", &b) marshalHelper(t, "Y", &b)
@ -333,6 +340,17 @@ func TestUnmarshalBoolean(t *testing.T) {
unmarshalHelper(t, "N\n \t", &b, &overwritten) unmarshalHelper(t, "N\n \t", &b, &overwritten)
} }
func TestStringBoolean(t *testing.T) {
var b Boolean = true
if b.String() != "true" {
t.Fatalf("Unexpected string for Boolean.String() for true: %s\n", b.String())
}
b = false
if b.String() != "false" {
t.Fatalf("Unexpected string for Boolean.String() for false: %s\n", b.String())
}
}
func TestMarshalUID(t *testing.T) { func TestMarshalUID(t *testing.T) {
var u UID = "d1cf3d3d-9ef9-4a97-b180-81706829cb04" var u UID = "d1cf3d3d-9ef9-4a97-b180-81706829cb04"
marshalHelper(t, "d1cf3d3d-9ef9-4a97-b180-81706829cb04", &u) marshalHelper(t, "d1cf3d3d-9ef9-4a97-b180-81706829cb04", &u)