1
0
mirror of https://github.com/golang/go synced 2024-10-05 03:21:23 -06:00
go/src/pkg/gob/encoder_test.go

38 lines
570 B
Go
Raw Normal View History

// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gob
import (
"bytes";
"gob";
"os";
"reflect";
"strings";
"testing";
"unsafe";
)
type ET2 struct {
x string;
}
type ET1 struct {
a int;
et2 *ET2;
next *ET1;
}
func TestBasicEncoder(t *testing.T) {
b := new(bytes.Buffer);
enc := NewEncoder(b);
et1 := new(ET1);
et1.a = 7;
et1.et2 = new(ET2);
enc.Encode(et1);
if enc.state.err != nil {
t.Error("encoder fail:", enc.state.err)
}
}