Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(77)

Delta Between Two Patch Sets: src/pkg/crypto/openpgp/packet/compressed_test.go

Issue 4124054: code review 4124054: crypto/openpgp/packet: two more packet types. (Closed)
Left Patch Set: Created 14 years, 1 month ago
Right Patch Set: diff -r d9b414fc9626 https://go.googlecode.com/hg/ Created 14 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/crypto/openpgp/packet/compressed.go ('k') | src/pkg/crypto/openpgp/packet/private_key.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package packet
6
7 import (
8 "bytes"
9 "encoding/hex"
10 "os"
11 "io/ioutil"
12 "testing"
13 )
14
15 func TestCompressed(t *testing.T) {
16 packet, err := Read(readerFromHex(compressedHex))
17 if err != nil {
18 t.Errorf("failed to read Compressed: %s", err)
19 return
20 }
21
22 c, ok := packet.(*Compressed)
23 if !ok {
24 t.Error("didn't find Compressed packet")
25 return
26 }
27
28 contents, err := ioutil.ReadAll(c.Body)
29 if err != nil && err != os.EOF {
30 t.Error(err)
31 return
32 }
33
34 expected, _ := hex.DecodeString(compressedExpectedHex)
35 if !bytes.Equal(expected, contents) {
36 t.Errorf("got:%x want:%x", contents, expected)
37 }
38 }
39
40 const compressedHex = "a3013b2d90c4e02b72e25f727e5e496a5e49b11e1700"
41 const compressedExpectedHex = "cb1062004d14c8fe636f6e74656e74732e0a"
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b