perkeep.org/issue/305
(t *testing.T)
| 488 | |
| 489 | // perkeep.org/issue/305 |
| 490 | func TestIssue305(t *testing.T) { |
| 491 | var in = `{"camliVersion": 1, |
| 492 | "camliType": "file", |
| 493 | "fileName": "2012-03-10 15.03.18.m4v", |
| 494 | "parts": [ |
| 495 | { |
| 496 | "bytesRef": "sha1-c76d8b17b887c207875e61a77b7eccc60289e61c", |
| 497 | "size": 20032564 |
| 498 | } |
| 499 | ] |
| 500 | }` |
| 501 | var ss superset |
| 502 | if err := json.NewDecoder(strings.NewReader(in)).Decode(&ss); err != nil { |
| 503 | t.Fatal(err) |
| 504 | } |
| 505 | inref := blob.RefFromString(in) |
| 506 | blob, err := BlobFromReader(inref, strings.NewReader(in)) |
| 507 | if err != nil { |
| 508 | t.Fatal(err) |
| 509 | } |
| 510 | if blob.BlobRef() != inref { |
| 511 | t.Errorf("original ref = %s; want %s", blob.BlobRef(), inref) |
| 512 | } |
| 513 | bb := blob.Builder() |
| 514 | jback, err := bb.JSON() |
| 515 | if err != nil { |
| 516 | t.Fatal(err) |
| 517 | } |
| 518 | if jback != in { |
| 519 | t.Errorf("JSON doesn't match:\n got: %q\nwant: %q\n", jback, in) |
| 520 | } |
| 521 | out := bb.Blob() |
| 522 | if got := out.BlobRef(); got != inref { |
| 523 | t.Errorf("cloned ref = %v; want %v", got, inref) |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | func TestStaticFileAndStaticSymlink(t *testing.T) { |
| 528 | // TODO (marete): Split this into two test functions. |
nothing calls this directly
no test coverage detected