summaryrefslogtreecommitdiff
path: root/libgo/go/encoding
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-07 01:16:20 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-07 01:16:20 +0000
commita2fe6cb095bbd0d5fe68a33b1faa9f6e417a2401 (patch)
tree28d4e50a31f7428050763b36e3c7bbdeeb541a0f /libgo/go/encoding
parent7070a9f28245b3378b8e8eb36a61b1e6c30586ad (diff)
downloadgcc-a2fe6cb095bbd0d5fe68a33b1faa9f6e417a2401.tar.gz
libgo: Implement and use runtime.Caller, runtime.Func.FileLine.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185025 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/encoding')
-rw-r--r--libgo/go/encoding/binary/binary_test.go5
-rw-r--r--libgo/go/encoding/binary/export_test.go15
-rw-r--r--libgo/go/encoding/binary/varint_test.go7
3 files changed, 22 insertions, 5 deletions
diff --git a/libgo/go/encoding/binary/binary_test.go b/libgo/go/encoding/binary/binary_test.go
index ff361b7e379..dec47a1894f 100644
--- a/libgo/go/encoding/binary/binary_test.go
+++ b/libgo/go/encoding/binary/binary_test.go
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package binary
+package binary_test
import (
"bytes"
+ . "encoding/binary"
"io"
"math"
"reflect"
@@ -187,7 +188,7 @@ func BenchmarkReadStruct(b *testing.B) {
bsr := &byteSliceReader{}
var buf bytes.Buffer
Write(&buf, BigEndian, &s)
- n := dataSize(reflect.ValueOf(s))
+ n := DataSize(reflect.ValueOf(s))
b.SetBytes(int64(n))
t := s
b.ResetTimer()
diff --git a/libgo/go/encoding/binary/export_test.go b/libgo/go/encoding/binary/export_test.go
new file mode 100644
index 00000000000..9eae2a961fc
--- /dev/null
+++ b/libgo/go/encoding/binary/export_test.go
@@ -0,0 +1,15 @@
+// Copyright 2012 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 binary
+
+import "reflect"
+
+// Export for testing.
+
+func DataSize(v reflect.Value) int {
+ return dataSize(v)
+}
+
+var Overflow = overflow
diff --git a/libgo/go/encoding/binary/varint_test.go b/libgo/go/encoding/binary/varint_test.go
index 9476bd5fb7a..f67ca6321bd 100644
--- a/libgo/go/encoding/binary/varint_test.go
+++ b/libgo/go/encoding/binary/varint_test.go
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package binary
+package binary_test
import (
"bytes"
+ . "encoding/binary"
"io"
"testing"
)
@@ -134,8 +135,8 @@ func testOverflow(t *testing.T, buf []byte, n0 int, err0 error) {
}
func TestOverflow(t *testing.T) {
- testOverflow(t, []byte{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x2}, -10, overflow)
- testOverflow(t, []byte{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x1, 0, 0}, -13, overflow)
+ testOverflow(t, []byte{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x2}, -10, Overflow)
+ testOverflow(t, []byte{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x1, 0, 0}, -13, Overflow)
}
func TestNonCanonicalZero(t *testing.T) {