summaryrefslogtreecommitdiffstats
path: root/llgo/test/llgoi/interfaces.test
diff options
context:
space:
mode:
Diffstat (limited to 'llgo/test/llgoi/interfaces.test')
-rw-r--r--llgo/test/llgoi/interfaces.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/llgo/test/llgoi/interfaces.test b/llgo/test/llgoi/interfaces.test
new file mode 100644
index 00000000000..bc12b09ab66
--- /dev/null
+++ b/llgo/test/llgoi/interfaces.test
@@ -0,0 +1,19 @@
+// RUN: llgoi < %s | FileCheck %s
+
+import "errors"
+err := errors.New("foo")
+// CHECK: err error {{.*}} = foo
+
+err.(interface{Foo()})
+// CHECK: panic: interface conversion
+
+_, _ := err.(interface{Foo()})
+// CHECK: #0 interface{Foo()} (<nil>) = <nil>
+// CHECK: #1 bool = false
+
+err.(interface{Error() string})
+// CHECK: #0 interface{Error() string} {{.*}} = foo
+
+_, _ := err.(interface{Error() string})
+// CHECK: #0 interface{Error() string} {{.*}} = foo
+// CHECK: #1 bool = true
OpenPOWER on IntegriCloud