...

Text file src/cmd/gofmt/testdata/composites.input

Documentation: cmd/gofmt/testdata

     1//gofmt -s
     2
     3package P
     4
     5type T struct {
     6	x, y int
     7}
     8
     9type T2 struct {
    10	w, z int
    11}
    12
    13var _ = [42]T{
    14	T{},
    15	T{1, 2},
    16	T{3, 4},
    17}
    18
    19var _ = [...]T{
    20	T{},
    21	T{1, 2},
    22	T{3, 4},
    23}
    24
    25var _ = []T{
    26	T{},
    27	T{1, 2},
    28	T{3, 4},
    29}
    30
    31var _ = []T{
    32	T{},
    33	10: T{1, 2},
    34	20: T{3, 4},
    35}
    36
    37var _ = []struct {
    38	x, y int
    39}{
    40	struct{ x, y int }{},
    41	10: struct{ x, y int }{1, 2},
    42	20: struct{ x, y int }{3, 4},
    43}
    44
    45var _ = []interface{}{
    46	T{},
    47	10: T{1, 2},
    48	20: T{3, 4},
    49}
    50
    51var _ = [][]int{
    52	[]int{},
    53	[]int{1, 2},
    54	[]int{3, 4},
    55}
    56
    57var _ = [][]int{
    58	([]int{}),
    59	([]int{1, 2}),
    60	[]int{3, 4},
    61}
    62
    63var _ = [][][]int{
    64	[][]int{},
    65	[][]int{
    66		[]int{},
    67		[]int{0, 1, 2, 3},
    68		[]int{4, 5},
    69	},
    70}
    71
    72var _ = map[string]T{
    73	"foo": T{},
    74	"bar": T{1, 2},
    75	"bal": T{3, 4},
    76}
    77
    78var _ = map[string]struct {
    79	x, y int
    80}{
    81	"foo": struct{ x, y int }{},
    82	"bar": struct{ x, y int }{1, 2},
    83	"bal": struct{ x, y int }{3, 4},
    84}
    85
    86var _ = map[string]interface{}{
    87	"foo": T{},
    88	"bar": T{1, 2},
    89	"bal": T{3, 4},
    90}
    91
    92var _ = map[string][]int{
    93	"foo": []int{},
    94	"bar": []int{1, 2},
    95	"bal": []int{3, 4},
    96}
    97
    98var _ = map[string][]int{
    99	"foo": ([]int{}),
   100	"bar": ([]int{1, 2}),
   101	"bal": []int{3, 4},
   102}
   103
   104// from exp/4s/data.go
   105var pieces4 = []Piece{
   106	Piece{0, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil},
   107	Piece{1, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil},
   108	Piece{2, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil},
   109	Piece{3, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil},
   110}
   111
   112var _ = [42]*T{
   113	&T{},
   114	&T{1, 2},
   115	&T{3, 4},
   116}
   117
   118var _ = [...]*T{
   119	&T{},
   120	&T{1, 2},
   121	&T{3, 4},
   122}
   123
   124var _ = []*T{
   125	&T{},
   126	&T{1, 2},
   127	&T{3, 4},
   128}
   129
   130var _ = []*T{
   131	&T{},
   132	10: &T{1, 2},
   133	20: &T{3, 4},
   134}
   135
   136var _ = []*struct {
   137	x, y int
   138}{
   139	&struct{ x, y int }{},
   140	10: &struct{ x, y int }{1, 2},
   141	20: &struct{ x, y int }{3, 4},
   142}
   143
   144var _ = []interface{}{
   145	&T{},
   146	10: &T{1, 2},
   147	20: &T{3, 4},
   148}
   149
   150var _ = []*[]int{
   151	&[]int{},
   152	&[]int{1, 2},
   153	&[]int{3, 4},
   154}
   155
   156var _ = []*[]int{
   157	(&[]int{}),
   158	(&[]int{1, 2}),
   159	&[]int{3, 4},
   160}
   161
   162var _ = []*[]*[]int{
   163	&[]*[]int{},
   164	&[]*[]int{
   165		&[]int{},
   166		&[]int{0, 1, 2, 3},
   167		&[]int{4, 5},
   168	},
   169}
   170
   171var _ = map[string]*T{
   172	"foo": &T{},
   173	"bar": &T{1, 2},
   174	"bal": &T{3, 4},
   175}
   176
   177var _ = map[string]*struct {
   178	x, y int
   179}{
   180	"foo": &struct{ x, y int }{},
   181	"bar": &struct{ x, y int }{1, 2},
   182	"bal": &struct{ x, y int }{3, 4},
   183}
   184
   185var _ = map[string]interface{}{
   186	"foo": &T{},
   187	"bar": &T{1, 2},
   188	"bal": &T{3, 4},
   189}
   190
   191var _ = map[string]*[]int{
   192	"foo": &[]int{},
   193	"bar": &[]int{1, 2},
   194	"bal": &[]int{3, 4},
   195}
   196
   197var _ = map[string]*[]int{
   198	"foo": (&[]int{}),
   199	"bar": (&[]int{1, 2}),
   200	"bal": &[]int{3, 4},
   201}
   202
   203var pieces4 = []*Piece{
   204	&Piece{0, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil},
   205	&Piece{1, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil},
   206	&Piece{2, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil},
   207	&Piece{3, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil},
   208}
   209
   210var _ = map[T]T2{
   211	T{1, 2}: T2{3, 4},
   212	T{5, 6}: T2{7, 8},
   213}
   214
   215var _ = map[*T]*T2{
   216	&T{1, 2}: &T2{3, 4},
   217	&T{5, 6}: &T2{7, 8},
   218}

View as plain text