aboutsummaryrefslogtreecommitdiff
path: root/test/blank.go
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2013-02-21 12:48:38 -0500
committerAlan Donovan <adonovan@google.com>2013-02-21 12:48:38 -0500
commitaa5aaabb0d18d21d97e9c98d7dfde4899a498335 (patch)
treef73106a0e13ea4ab7f6e94345185104cc29d771a /test/blank.go
parentdf93283d5694814efc97efd2132da11722d11523 (diff)
downloadgo-aa5aaabb0d18d21d97e9c98d7dfde4899a498335.tar.gz
go-aa5aaabb0d18d21d97e9c98d7dfde4899a498335.zip
exp/ssa/interp: (#6 of 5): test interpretation of SSA form of $GOROOT/test/*.go.
The interpreter's os.Exit now triggers a special panic rather than kill the test process. (It's semantically dubious, since it will run deferred routines.) Interpret now returns its exit code rather than calling os.Exit. Also: - disabled parts of a few $GOROOT/tests via os.Getenv("GOSSAINTERP"). - remove unnecessary 'slots' param to external functions; they are never closures. Most of the tests are disabled until go/types supports shifts. They can be reenabled if you patch this workaround: https://golang.org/cl/7312068 R=iant, bradfitz CC=golang-dev, gri https://golang.org/cl/7313062
Diffstat (limited to 'test/blank.go')
-rw-r--r--test/blank.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/test/blank.go b/test/blank.go
index ad4d6ebdc6..7f7d9f6f7f 100644
--- a/test/blank.go
+++ b/test/blank.go
@@ -8,7 +8,10 @@
package main
-import "unsafe"
+import (
+ "os"
+ "unsafe"
+)
import _ "fmt"
@@ -104,11 +107,15 @@ func main() {
panic(sum)
}
- type T1 struct{ x, y, z int }
- t1 := *(*T)(unsafe.Pointer(&T1{1, 2, 3}))
- t2 := *(*T)(unsafe.Pointer(&T1{4, 5, 6}))
- if t1 != t2 {
- panic("T{} != T{}")
+ // exp/ssa/interp doesn't yet skip blank fields in struct
+ // equivalence. It also cannot support unsafe.Pointer.
+ if os.Getenv("GOSSAINTERP") == "" {
+ type T1 struct{ x, y, z int }
+ t1 := *(*T)(unsafe.Pointer(&T1{1, 2, 3}))
+ t2 := *(*T)(unsafe.Pointer(&T1{4, 5, 6}))
+ if t1 != t2 {
+ panic("T{} != T{}")
+ }
}
h(a, b)