Commit 7151d233 authored by Robert Griesemer's avatar Robert Griesemer

missing piece gofmt'ed in reflect

R=r, rsc
http://go/go-review/1025001
parent 45cba57e
...@@ -42,91 +42,141 @@ func typestring(i interface{}) string { ...@@ -42,91 +42,141 @@ func typestring(i interface{}) string {
var typeTests = []pair{ var typeTests = []pair{
pair{struct { pair{struct {
x int; x int;
}{}, "int"}, }{},
"int",
},
pair{struct { pair{struct {
x int8; x int8;
}{}, "int8"}, }{},
"int8",
},
pair{struct { pair{struct {
x int16; x int16;
}{}, "int16"}, }{},
"int16",
},
pair{struct { pair{struct {
x int32; x int32;
}{}, "int32"}, }{},
"int32",
},
pair{struct { pair{struct {
x int64; x int64;
}{}, "int64"}, }{},
"int64",
},
pair{struct { pair{struct {
x uint; x uint;
}{}, "uint"}, }{},
"uint",
},
pair{struct { pair{struct {
x uint8; x uint8;
}{}, "uint8"}, }{},
"uint8",
},
pair{struct { pair{struct {
x uint16; x uint16;
}{}, "uint16"}, }{},
"uint16",
},
pair{struct { pair{struct {
x uint32; x uint32;
}{}, "uint32"}, }{},
"uint32",
},
pair{struct { pair{struct {
x uint64; x uint64;
}{}, "uint64"}, }{},
"uint64",
},
pair{struct { pair{struct {
x float; x float;
}{}, "float"}, }{},
"float",
},
pair{struct { pair{struct {
x float32; x float32;
}{}, "float32"}, }{},
"float32",
},
pair{struct { pair{struct {
x float64; x float64;
}{}, "float64"}, }{},
"float64",
},
pair{struct { pair{struct {
x int8; x int8;
}{}, "int8"}, }{},
"int8",
},
pair{struct { pair{struct {
x (**int8); x (**int8);
}{}, "**int8"}, }{},
"**int8",
},
pair{struct { pair{struct {
x (**integer); x (**integer);
}{}, "**reflect_test.integer"}, }{},
"**reflect_test.integer",
},
pair{struct { pair{struct {
x ([32]int32); x ([32]int32);
}{}, "[32]int32"}, }{},
"[32]int32",
},
pair{struct { pair{struct {
x ([]int8); x ([]int8);
}{}, "[]int8"}, }{},
"[]int8",
},
pair{struct { pair{struct {
x (map[string]int32); x (map[string]int32);
}{}, "map[string] int32"}, }{},
"map[string] int32",
},
pair{struct { pair{struct {
x (chan<- string); x (chan<- string);
}{}, "chan<- string"}, }{},
"chan<- string",
},
pair{struct { pair{struct {
x struct { x struct {
c chan *int32; c chan *int32;
d float32; d float32;
}; };
}{}, "struct { c chan *int32; d float32 }"}, }{},
"struct { c chan *int32; d float32 }",
},
pair{struct { pair{struct {
x (func(a int8, b int32)); x (func(a int8, b int32));
}{}, "func(int8, int32)"}, }{},
"func(int8, int32)",
},
pair{struct { pair{struct {
x struct { x struct {
c func(chan *integer, *int8); c func(chan *integer, *int8);
}; };
}{}, "struct { c func(chan *reflect_test.integer, *int8) }"}, }{},
"struct { c func(chan *reflect_test.integer, *int8) }",
},
pair{struct { pair{struct {
x struct { x struct {
a int8; a int8;
b int32; b int32;
}; };
}{}, "struct { a int8; b int32 }"}, }{},
"struct { a int8; b int32 }",
},
pair{struct { pair{struct {
x struct { x struct {
a int8; a int8;
b int8; b int8;
c int32; c int32;
}; };
}{}, "struct { a int8; b int8; c int32 }"}, }{},
"struct { a int8; b int8; c int32 }",
},
pair{struct { pair{struct {
x struct { x struct {
a int8; a int8;
...@@ -134,7 +184,9 @@ var typeTests = []pair{ ...@@ -134,7 +184,9 @@ var typeTests = []pair{
c int8; c int8;
d int32; d int32;
}; };
}{}, "struct { a int8; b int8; c int8; d int32 }"}, }{},
"struct { a int8; b int8; c int8; d int32 }",
},
pair{struct { pair{struct {
x struct { x struct {
a int8; a int8;
...@@ -143,7 +195,9 @@ var typeTests = []pair{ ...@@ -143,7 +195,9 @@ var typeTests = []pair{
d int8; d int8;
e int32; e int32;
}; };
}{}, "struct { a int8; b int8; c int8; d int8; e int32 }"}, }{},
"struct { a int8; b int8; c int8; d int8; e int32 }",
},
pair{struct { pair{struct {
x struct { x struct {
a int8; a int8;
...@@ -153,28 +207,38 @@ var typeTests = []pair{ ...@@ -153,28 +207,38 @@ var typeTests = []pair{
e int8; e int8;
f int32; f int32;
}; };
}{}, "struct { a int8; b int8; c int8; d int8; e int8; f int32 }"}, }{},
"struct { a int8; b int8; c int8; d int8; e int8; f int32 }",
},
pair{struct { pair{struct {
x struct { x struct {
a int8 "hi there"; a int8 "hi there";
}; };
}{}, `struct { a int8 "hi there" }`}, }{},
`struct { a int8 "hi there" }`,
},
pair{struct { pair{struct {
x struct { x struct {
a int8 "hi \x00there\t\n\"\\"; a int8 "hi \x00there\t\n\"\\";
}; };
}{}, `struct { a int8 "hi \x00there\t\n\"\\" }`}, }{},
`struct { a int8 "hi \x00there\t\n\"\\" }`,
},
pair{struct { pair{struct {
x struct { x struct {
f func(args ...); f func(args ...);
}; };
}{}, "struct { f func(...) }"}, }{},
"struct { f func(...) }",
},
pair{struct { pair{struct {
x (interface { x (interface {
a(func(func(int) int) (func(func(int)) int)); a(func(func(int) int) (func(func(int)) int));
b(); b();
}); });
}{}, "interface { a (func(func(int) (int)) (func(func(int)) (int))); b () }"}, }{},
"interface { a (func(func(int) (int)) (func(func(int)) (int))); b () }",
},
} }
var valueTests = []pair{ var valueTests = []pair{
...@@ -199,20 +263,28 @@ var valueTests = []pair{ ...@@ -199,20 +263,28 @@ var valueTests = []pair{
pair{(struct { pair{(struct {
c chan *int32; c chan *int32;
d float32; d float32;
}){}, "struct { c chan *int32; d float32 }{chan *int32, 0}"}, }){},
"struct { c chan *int32; d float32 }{chan *int32, 0}",
},
pair{(func(a int8, b int32))(nil), "func(int8, int32)(0)"}, pair{(func(a int8, b int32))(nil), "func(int8, int32)(0)"},
pair{(struct { pair{(struct {
c func(chan *integer, *int8); c func(chan *integer, *int8);
}){}, "struct { c func(chan *reflect_test.integer, *int8) }{func(chan *reflect_test.integer, *int8)(0)}"}, }){},
"struct { c func(chan *reflect_test.integer, *int8) }{func(chan *reflect_test.integer, *int8)(0)}",
},
pair{(struct { pair{(struct {
a int8; a int8;
b int32; b int32;
}){}, "struct { a int8; b int32 }{0, 0}"}, }){},
"struct { a int8; b int32 }{0, 0}",
},
pair{(struct { pair{(struct {
a int8; a int8;
b int8; b int8;
c int32; c int32;
}){}, "struct { a int8; b int8; c int32 }{0, 0, 0}"}, }){},
"struct { a int8; b int8; c int32 }{0, 0, 0}",
},
} }
func testType(t *testing.T, i int, typ Type, want string) { func testType(t *testing.T, i int, typ Type, want string) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment