diff options
-rw-r--r-- | skate/schema_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/skate/schema_test.go b/skate/schema_test.go index 3267072..7616001 100644 --- a/skate/schema_test.go +++ b/skate/schema_test.go @@ -1,6 +1,7 @@ package skate import ( + "bytes" "encoding/json" "fmt" "reflect" @@ -256,6 +257,22 @@ func TestLinkHash(t *testing.T) { } } +func TestSchemaMarshal(t *testing.T) { + + // CSL when issued is empty, but accepted is not + var csl = CSL{ + Title: "test-doc", + Issued: &CSLDate{ + Raw: "2012", + }, + } + var csl_json = []byte(`{"issued":{"raw":"2012"},"title":"test-doc"}`) + var csl_encoded, _ = json.Marshal(csl) + if bytes.Compare(csl_json, csl_encoded) != 0 { + t.Fatalf("got:\n%v\nwant:\n%v\n", string(csl_json[:]), string(csl_encoded[:])) + } +} + func TestReleaseToUnstructured(t *testing.T) { var cases = []struct { r *Release |