OSDN Git Service

libgo: Update to weekly.2011-12-02.
[pf3gnuchains/gcc-fork.git] / libgo / go / encoding / asn1 / marshal_test.go
index 03df5f1..d05b5d8 100644 (file)
@@ -51,10 +51,7 @@ type optionalRawValueTest struct {
 
 type testSET []int
 
-func setPST(t *time.Time) *time.Time {
-       t.ZoneOffset = -28800
-       return t
-}
+var PST = time.FixedZone("PST", -8*60*60)
 
 type marshalTest struct {
        in  interface{}
@@ -73,9 +70,9 @@ var marshalTests = []marshalTest{
        {[]byte{1, 2, 3}, "0403010203"},
        {implicitTagTest{64}, "3003850140"},
        {explicitTagTest{64}, "3005a503020140"},
-       {time.SecondsToUTC(0), "170d3730303130313030303030305a"},
-       {time.SecondsToUTC(1258325776), "170d3039313131353232353631365a"},
-       {setPST(time.SecondsToUTC(1258325776)), "17113039313131353232353631362d30383030"},
+       {time.Unix(0, 0).UTC(), "170d3730303130313030303030305a"},
+       {time.Unix(1258325776, 0).UTC(), "170d3039313131353232353631365a"},
+       {time.Unix(1258325776, 0).In(PST), "17113039313131353232353631362d30383030"},
        {BitString{[]byte{0x80}, 1}, "03020780"},
        {BitString{[]byte{0x81, 0xf0}, 12}, "03030481f0"},
        {ObjectIdentifier([]int{1, 2, 3, 4}), "06032a0304"},
@@ -123,7 +120,8 @@ func TestMarshal(t *testing.T) {
                }
                out, _ := hex.DecodeString(test.out)
                if bytes.Compare(out, data) != 0 {
-                       t.Errorf("#%d got: %x want %x", i, data, out)
+                       t.Errorf("#%d got: %x want %x\n\t%q\n\t%q", i, data, out, data, out)
+
                }
        }
 }