summaryrefslogtreecommitdiff
path: root/src/pkg/json/struct_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-10-06 19:41:51 -0700
committerRuss Cox <rsc@golang.org>2009-10-06 19:41:51 -0700
commit6c2652e6fd54ce34ca3be95540c54cebb52bfece (patch)
tree2366cc62ab4dee2e5698d6d6e5b299d6819a7edd /src/pkg/json/struct_test.go
parentdb62e99a735a036afda2098f1a721fe8dbf6ce76 (diff)
downloadgolang-6c2652e6fd54ce34ca3be95540c54cebb52bfece.tar.gz
apply gofmt to go, gob, hash, http, image, io, json, log
R=gri DELTA=1359 (138 added, 32 deleted, 1189 changed) OCL=35408 CL=35420
Diffstat (limited to 'src/pkg/json/struct_test.go')
-rw-r--r--src/pkg/json/struct_test.go87
1 files changed, 43 insertions, 44 deletions
diff --git a/src/pkg/json/struct_test.go b/src/pkg/json/struct_test.go
index ce0ab3473..42b54b9db 100644
--- a/src/pkg/json/struct_test.go
+++ b/src/pkg/json/struct_test.go
@@ -9,32 +9,31 @@ import (
)
type _MyStruct struct {
- T bool;
- F bool;
- S string;
- I8 int8;
- I16 int16;
- I32 int32;
- I64 int64;
- U8 uint8;
- U16 uint16;
- U32 uint32;
- U64 uint64;
- I int;
- U uint;
- Fl float;
- Fl32 float32;
- Fl64 float64;
- A []string;
- My *_MyStruct;
-};
+ T bool;
+ F bool;
+ S string;
+ I8 int8;
+ I16 int16;
+ I32 int32;
+ I64 int64;
+ U8 uint8;
+ U16 uint16;
+ U32 uint32;
+ U64 uint64;
+ I int;
+ U uint;
+ Fl float;
+ Fl32 float32;
+ Fl64 float64;
+ A []string;
+ My *_MyStruct;
+}
-const _Encoded =
- `{"t":true,"f":false,"s":"abc","i8":1,"i16":2,"i32":3,"i64":4,`
+const _Encoded = `{"t":true,"f":false,"s":"abc","i8":1,"i16":2,"i32":3,"i64":4,`
` "u8":5,"u16":6,"u32":7,"u64":8,`
` "i":-9,"u":10,"bogusfield":"should be ignored",`
` "fl":11.5,"fl32":12.25,"fl64":13.75,`
- ` "a":["x","y","z"],"my":{"s":"subguy"}}`;
+ ` "a":["x","y","z"],"my":{"s":"subguy"}}`
func _Check(t *testing.T, ok bool, name string, v interface{}) {
@@ -52,30 +51,30 @@ func TestUnmarshal(t *testing.T) {
if !ok {
t.Fatalf("Unmarshal failed near %s", errtok);
}
- _Check(t, m.T==true, "t", m.T);
- _Check(t, m.F==false, "f", m.F);
- _Check(t, m.S=="abc", "s", m.S);
- _Check(t, m.I8==1, "i8", m.I8);
- _Check(t, m.I16==2, "i16", m.I16);
- _Check(t, m.I32==3, "i32", m.I32);
- _Check(t, m.I64==4, "i64", m.I64);
- _Check(t, m.U8==5, "u8", m.U8);
- _Check(t, m.U16==6, "u16", m.U16);
- _Check(t, m.U32==7, "u32", m.U32);
- _Check(t, m.U64==8, "u64", m.U64);
- _Check(t, m.I==-9, "i", m.I);
- _Check(t, m.U==10, "u", m.U);
- _Check(t, m.Fl==11.5, "fl", m.Fl);
- _Check(t, m.Fl32==12.25, "fl32", m.Fl32);
- _Check(t, m.Fl64==13.75, "fl64", m.Fl64);
- _Check(t, m.A!=nil, "a", m.A);
+ _Check(t, m.T == true, "t", m.T);
+ _Check(t, m.F == false, "f", m.F);
+ _Check(t, m.S == "abc", "s", m.S);
+ _Check(t, m.I8 == 1, "i8", m.I8);
+ _Check(t, m.I16 == 2, "i16", m.I16);
+ _Check(t, m.I32 == 3, "i32", m.I32);
+ _Check(t, m.I64 == 4, "i64", m.I64);
+ _Check(t, m.U8 == 5, "u8", m.U8);
+ _Check(t, m.U16 == 6, "u16", m.U16);
+ _Check(t, m.U32 == 7, "u32", m.U32);
+ _Check(t, m.U64 == 8, "u64", m.U64);
+ _Check(t, m.I == -9, "i", m.I);
+ _Check(t, m.U == 10, "u", m.U);
+ _Check(t, m.Fl == 11.5, "fl", m.Fl);
+ _Check(t, m.Fl32 == 12.25, "fl32", m.Fl32);
+ _Check(t, m.Fl64 == 13.75, "fl64", m.Fl64);
+ _Check(t, m.A != nil, "a", m.A);
if m.A != nil {
- _Check(t, m.A[0]=="x", "a[0]", m.A[0]);
- _Check(t, m.A[1]=="y", "a[1]", m.A[1]);
- _Check(t, m.A[2]=="z", "a[2]", m.A[2]);
+ _Check(t, m.A[0] == "x", "a[0]", m.A[0]);
+ _Check(t, m.A[1] == "y", "a[1]", m.A[1]);
+ _Check(t, m.A[2] == "z", "a[2]", m.A[2]);
}
- _Check(t, m.My!=nil, "my", m.My);
+ _Check(t, m.My != nil, "my", m.My);
if m.My != nil {
- _Check(t, m.My.S=="subguy", "my.s", m.My.S);
+ _Check(t, m.My.S == "subguy", "my.s", m.My.S);
}
}