-func TestParse(t *testing.T) {
- for _, x := range testData {
- tt, f, err := ParseBody(x.C.Body)
+var docData = []struct {
+ text string
+ ok bool
+ t string
+ k []string
+ v []string
+}{
+ {
+ `Content-Type: text/vnd.epoint.draft; charset=utf-8
+
+K1: v1
+K2-Foo: v 2
+K3: v 3
+`, true, "Draft", []string{"K1", "K2-Foo", "K3"}, []string{"v1", "v 2", "v 3"}},
+ {
+ `Content-Type: text/vnd.epoint.debit; charset=utf-8
+
+K1: v1
+K2-Foo: v 2
+K3: v 3
+`, true, "DebitCert", []string{"K1", "K2-Foo", "K3"}, []string{" v1", "v 2", "v 3"}},
+ {
+ `Content-Type: text/vnd.epoint.credit; charset=utf-8
+
+K1: v1
+K2-Foo: v 2
+K3: v
+ 3
+`, false, "CreditCert", []string{"K1", "K2-Foo", "K3"}, []string{"v1", "v 2", "v 3"}},
+}
+
+func TestDocument(t *testing.T) {
+ for _, x := range docData {
+ doc, err := ParseDocument([]byte(x.text))