Changes
2 changed files (+12/-9)
-
-
@@ -326,17 +326,21 @@ func JSONLdName(n string, tag jsonLdTag) string {// func Marshal(v interface{}, ctx *Context) ([]byte, error) { e := &encodeState{} errC := e.marshal(ctx, encOpts{escapeHTML: true}) if errC != nil { return nil, errC } err := e.marshal(v, encOpts{escapeHTML: true}) if err != nil { return nil, err } output := e.Bytes() if ctx == nil { return e.Bytes(), nil } errC := e.marshal(ctx, encOpts{escapeHTML: true}) if errC != nil { return nil, errC } output := e.Bytes() return bytes.Replace(output, []byte("}{"), []byte(", "), 1), nil } // Marshaler is the interface implemented by types that
-
-
-
@@ -2,7 +2,6 @@ package jsonldimport ( "bytes" "encoding/json" "reflect" "strings" "testing"
-
@@ -36,7 +35,7 @@ func TestMarshal(t *testing.T) {if !strings.Contains(string(out), url) { t.Errorf("Context url not found '%s' in %s", url, out) } err = json.Unmarshal(out, &b) err = Unmarshal(out, &b) if err != nil { t.Errorf("%s", err) }
-
@@ -117,7 +116,7 @@ func TestPayloadWithContext_MarshalJSON(t *testing.T) {if eErr != nil { t.Errorf("Error: %s", eErr) } n, _ := json.Marshal(nil) n, _ := Marshal(nil, nil) if bytes.Compare(eData, n) != 0 { t.Errorf("Empty payload should resolve to null json value '%s', received '%s'", n, eData) }
-
@@ -130,7 +129,7 @@ func TestPayloadWithContext_MarshalJSON(t *testing.T) {if pErr != nil { t.Errorf("Error: %s", pErr) } av, _ := json.Marshal(a) av, _ := Marshal(a, nil) if bytes.Compare(pData, av) != 0 { t.Errorf("Empty payload should resolve to value '%#v', received '%s'", av, pData) }
-