summaryrefslogtreecommitdiff
path: root/test/bench/go1/json_test.go
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:36 +0100
commit04b08da9af0c450d645ab7389d1467308cfc2db8 (patch)
treedb247935fa4f2f94408edc3acd5d0d4f997aa0d8 /test/bench/go1/json_test.go
parent917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff)
downloadgolang-04b08da9af0c450d645ab7389d1467308cfc2db8.tar.gz
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
Diffstat (limited to 'test/bench/go1/json_test.go')
-rw-r--r--test/bench/go1/json_test.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/test/bench/go1/json_test.go b/test/bench/go1/json_test.go
index 5a3012167..614e24a81 100644
--- a/test/bench/go1/json_test.go
+++ b/test/bench/go1/json_test.go
@@ -17,11 +17,11 @@ import (
)
var (
- jsonbytes []byte
- jsondata JSONResponse
+ jsonbytes = makeJsonBytes()
+ jsondata = makeJsonData()
)
-func init() {
+func makeJsonBytes() []byte {
var r io.Reader
r = strings.NewReader(jsonbz2_base64)
r = base64.NewDecoder(base64.StdEncoding, r)
@@ -30,12 +30,15 @@ func init() {
if err != nil {
panic(err)
}
- jsonbytes = b
+ return b
+}
- if err := json.Unmarshal(jsonbytes, &jsondata); err != nil {
+func makeJsonData() JSONResponse {
+ var v JSONResponse
+ if err := json.Unmarshal(jsonbytes, &v); err != nil {
panic(err)
}
- gobinit()
+ return v
}
type JSONResponse struct {