summaryrefslogtreecommitdiff
path: root/src/pkg/json/decode_test.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-12-15 15:35:38 -0800
committerRobert Griesemer <gri@golang.org>2009-12-15 15:35:38 -0800
commite4bd81f903362d998f7bfc02095935408aff0bc5 (patch)
tree05f75a90e239d33be427da4f9c5596d2fcb3dc96 /src/pkg/json/decode_test.go
parentd9527dd16f72598b54a64550607bf892efa12384 (diff)
downloadgolang-e4bd81f903362d998f7bfc02095935408aff0bc5.tar.gz
1) Change default gofmt default settings for
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 3rd set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180048
Diffstat (limited to 'src/pkg/json/decode_test.go')
-rw-r--r--src/pkg/json/decode_test.go102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/pkg/json/decode_test.go b/src/pkg/json/decode_test.go
index 1b429b0ee..b712d6558 100644
--- a/src/pkg/json/decode_test.go
+++ b/src/pkg/json/decode_test.go
@@ -5,73 +5,73 @@
package json
import (
- "container/vector";
- "reflect";
- "testing";
+ "container/vector"
+ "reflect"
+ "testing"
)
func TestDecodeInt64(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Int64(-15);
- assertResult(t, nb.Data(), float64(-15));
+ nb := newDecoder(nil, nil)
+ nb.Int64(-15)
+ assertResult(t, nb.Data(), float64(-15))
}
func TestDecodeUint64(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Uint64(15);
- assertResult(t, nb.Data(), float64(15));
+ nb := newDecoder(nil, nil)
+ nb.Uint64(15)
+ assertResult(t, nb.Data(), float64(15))
}
func TestDecodeFloat64(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Float64(3.14159);
- assertResult(t, nb.Data(), float64(3.14159));
+ nb := newDecoder(nil, nil)
+ nb.Float64(3.14159)
+ assertResult(t, nb.Data(), float64(3.14159))
}
func TestDecodeString(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.String("Some string");
- assertResult(t, nb.Data(), "Some string");
+ nb := newDecoder(nil, nil)
+ nb.String("Some string")
+ assertResult(t, nb.Data(), "Some string")
}
func TestDecodeBool(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Bool(true);
- assertResult(t, nb.Data(), true);
+ nb := newDecoder(nil, nil)
+ nb.Bool(true)
+ assertResult(t, nb.Data(), true)
}
func TestDecodeNull(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Null();
- assertResult(t, nb.Data(), nil);
+ nb := newDecoder(nil, nil)
+ nb.Null()
+ assertResult(t, nb.Data(), nil)
}
func TestDecodeEmptyArray(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Array();
- assertResult(t, nb.Data(), []interface{}{});
+ nb := newDecoder(nil, nil)
+ nb.Array()
+ assertResult(t, nb.Data(), []interface{}{})
}
func TestDecodeEmptyMap(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Map();
- assertResult(t, nb.Data(), map[string]interface{}{});
+ nb := newDecoder(nil, nil)
+ nb.Map()
+ assertResult(t, nb.Data(), map[string]interface{}{})
}
func TestDecodeFlushElem(t *testing.T) {
- testVec := new(vector.Vector).Resize(2, 2);
- nb := newDecoder(testVec, 1);
- nb.Float64(3.14159);
- nb.Flush();
- assertResult(t, testVec.Data(), []interface{}{nil, float64(3.14159)});
+ testVec := new(vector.Vector).Resize(2, 2)
+ nb := newDecoder(testVec, 1)
+ nb.Float64(3.14159)
+ nb.Flush()
+ assertResult(t, testVec.Data(), []interface{}{nil, float64(3.14159)})
}
func TestDecodeFlushKey(t *testing.T) {
- testMap := make(map[string]interface{});
- nb := newDecoder(testMap, "key");
- nb.Float64(3.14159);
- nb.Flush();
- assertResult(t, testMap, map[string]interface{}{"key": float64(3.14159)});
+ testMap := make(map[string]interface{})
+ nb := newDecoder(testMap, "key")
+ nb.Float64(3.14159)
+ nb.Flush()
+ assertResult(t, testMap, map[string]interface{}{"key": float64(3.14159)})
}
// Elem() and Key() are hard to test in isolation because all they do
@@ -80,21 +80,21 @@ func TestDecodeFlushKey(t *testing.T) {
// Array(), String(), and Flush().
func TestDecodeElem(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Array();
- var b Builder = nb.Elem(0);
- b.String("0");
- b.Flush();
- assertResult(t, nb.Data(), []interface{}{"0"});
+ nb := newDecoder(nil, nil)
+ nb.Array()
+ var b Builder = nb.Elem(0)
+ b.String("0")
+ b.Flush()
+ assertResult(t, nb.Data(), []interface{}{"0"})
}
func TestDecodeKey(t *testing.T) {
- nb := newDecoder(nil, nil);
- nb.Map();
- var b Builder = nb.Key("a");
- b.String("0");
- b.Flush();
- assertResult(t, nb.Data(), map[string]interface{}{"a": "0"});
+ nb := newDecoder(nil, nil)
+ nb.Map()
+ var b Builder = nb.Key("a")
+ b.String("0")
+ b.Flush()
+ assertResult(t, nb.Data(), map[string]interface{}{"a": "0"})
}
func assertResult(t *testing.T, results, expected interface{}) {
@@ -104,8 +104,8 @@ func assertResult(t *testing.T, results, expected interface{}) {
}
type decodeTest struct {
- s string;
- r interface{};
+ s string
+ r interface{}
}
var tests = []decodeTest{