mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
encode and decode for nested structures.
fix a bug in delta encoding: only update the delta-base if something is marshaled. R=rsc DELTA=154 (94 added, 56 deleted, 4 changed) OCL=31069 CL=31071
This commit is contained in:
parent
1ca1e1befa
commit
77baac11e1
3 changed files with 96 additions and 58 deletions
|
|
@ -569,10 +569,14 @@ func TestScalarDecInstructions(t *testing.T) {
|
|||
|
||||
|
||||
func TestEncode(t *testing.T) {
|
||||
type T2 struct {
|
||||
t string
|
||||
}
|
||||
type T1 struct {
|
||||
a, b,c int;
|
||||
s string;
|
||||
y []byte;
|
||||
t *T2;
|
||||
}
|
||||
t1 := &T1{
|
||||
a: 17,
|
||||
|
|
@ -580,6 +584,7 @@ func TestEncode(t *testing.T) {
|
|||
c: -5,
|
||||
s: "Now is the time",
|
||||
y: strings.Bytes("hello, sailor"),
|
||||
t: &T2{"this is T2"},
|
||||
};
|
||||
b := new(bytes.Buffer);
|
||||
Encode(b, t1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue