OLD | NEW |
1 // $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: tuple evaluation order | 1 // $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: tuple evaluation order |
2 | 2 |
3 // Copyright 2010 The Go Authors. All rights reserved. | 3 // Copyright 2010 The Go Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style | 4 // Use of this source code is governed by a BSD-style |
5 // license that can be found in the LICENSE file. | 5 // license that can be found in the LICENSE file. |
6 | 6 |
7 // Test order of evaluation in tuple assignments. | 7 // Test order of evaluation in tuple assignments. |
8 | 8 |
9 package main | 9 package main |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 m[13] = 'B' | 94 m[13] = 'B' |
95 // 13 14 | 95 // 13 14 |
96 m[gint()] = gbyte(), false | 96 m[gint()] = gbyte(), false |
97 if _, present := m[13]; present { | 97 if _, present := m[13]; present { |
98 println("bad map removal") | 98 println("bad map removal") |
99 panic("fail") | 99 panic("fail") |
100 } | 100 } |
101 | 101 |
102 c := make(chan byte, 1) | 102 c := make(chan byte, 1) |
103 c <- 'C' | 103 c <- 'C' |
104 //TODO(rsc): uncomment when this syntax is valid for receive+check close
d | |
105 // 15 16 | 104 // 15 16 |
106 » //» *f(), p1 = <-e1(c, 16) | 105 » *f(), p1 = <-e1(c, 16) |
107 » *f(), p1 = <-e1(c, 16), true // delete uncommenting above | 106 » close(c) |
108 // 17 18 | 107 // 17 18 |
109 » //» *f(), p2 = <-e1(c, 18) | 108 » *f(), p2 = <-e1(c, 18) |
110 » *f(), p2, _ = 0, false, e1(c, 18) // delete when uncommenting above | |
111 a[17] += '0' | 109 a[17] += '0' |
112 if !p1 || p2 { | 110 if !p1 || p2 { |
113 println("bad chan check", i, p1, p2) | 111 println("bad chan check", i, p1, p2) |
114 panic("fail") | 112 panic("fail") |
115 } | 113 } |
116 | 114 |
117 s1 := S1{'D'} | 115 s1 := S1{'D'} |
118 s2 := S2{'E'} | 116 s2 := S2{'E'} |
119 var iv I | 117 var iv I |
120 // 19 20 | 118 // 19 20 |
121 *e3(&iv, 19), p1 = e2(s1, 20).(I) | 119 *e3(&iv, 19), p1 = e2(s1, 20).(I) |
122 // 21 22 | 120 // 21 22 |
123 *e3(&iv, 21), p2 = e2(s2, 22).(I) | 121 *e3(&iv, 21), p2 = e2(s2, 22).(I) |
124 if !p1 || p2 { | 122 if !p1 || p2 { |
125 println("bad interface check", i, p1, p2) | 123 println("bad interface check", i, p1, p2) |
126 panic("fail") | 124 panic("fail") |
127 } | 125 } |
128 | 126 |
129 s := string(a[0:i]) | 127 s := string(a[0:i]) |
130 if s != "def ii A 0 C 0 " { | 128 if s != "def ii A 0 C 0 " { |
131 println("bad array results:", s) | 129 println("bad array results:", s) |
132 panic("fail") | 130 panic("fail") |
133 } | 131 } |
134 } | 132 } |
OLD | NEW |