Changes
2 changed files (+21/-2)
-
-
@@ -2,7 +2,6 @@ package jsonldimport ( "encoding/json" "fmt" "reflect" )
-
@@ -81,7 +80,7 @@ type Encoder struct{}func Marshal(v interface{}, c *Context) ([]byte, error) { if c == nil { return nil, fmt.Errorf("nil error") return json.Marshal(v) } p := payloadWithContext{*c, &v} return p.MarshalJSON()
-
-
-
@@ -5,6 +5,7 @@ import ("reflect" "strings" "testing" "bytes" ) type mockBase struct {
-
@@ -56,6 +57,25 @@ func TestMarshal(t *testing.T) {} } func TestMarshalNullContext(t *testing.T) { var a = struct { PropA string PropB float64 } {"test", 0.0004} outL, errL := Marshal(a, nil ) if errL != nil { t.Errorf("%s", errL) } outJ, errJ := Marshal(a, nil ) if errJ != nil { t.Errorf("%s", errJ) } if !bytes.Equal(outL, outJ) { t.Errorf("Json output should be euqlal '%s', received '%s'", outL, outJ) } } func TestIsEmpty(t *testing.T) { var a int = 0 if !IsEmpty(reflect.ValueOf(a)) {
-