diff options
Diffstat (limited to 'skate/schema_test.go')
| -rw-r--r-- | skate/schema_test.go | 21 | 
1 files changed, 19 insertions, 2 deletions
diff --git a/skate/schema_test.go b/skate/schema_test.go index 3267072..59b1f58 100644 --- a/skate/schema_test.go +++ b/skate/schema_test.go @@ -1,6 +1,7 @@  package skate  import ( +	"bytes"  	"encoding/json"  	"fmt"  	"reflect" @@ -220,11 +221,11 @@ func TestLinkHash(t *testing.T) {  	}{  		{  			bref:     BiblioRef{}, -			linkHash: "7cae9fc61f167bc26cc3839f15457fe87b2be4e1", +			linkHash: "8b8c3f74dd1472aa8869ee3a58295b70c7064aa8",  		},  		{  			bref:     BiblioRef{SourceReleaseIdent: "123"}, -			linkHash: "a0969f96c14cb42d298117e1927bd409873173a2", +			linkHash: "23d0f9e279ec533f46a6b220f7a5758ec0c9d9af",  		},  		{  			bref: BiblioRef{ @@ -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{ +			Parts: [][]int{{2012}}, +		}, +	} +	var csl_json = []byte(`{"issued":{"date-parts":[[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  | 
