summaryrefslogtreecommitdiffstats
path: root/llgo/test/execution/chan/self.go
diff options
context:
space:
mode:
Diffstat (limited to 'llgo/test/execution/chan/self.go')
-rw-r--r--llgo/test/execution/chan/self.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/llgo/test/execution/chan/self.go b/llgo/test/execution/chan/self.go
new file mode 100644
index 00000000000..d26ee4a22f3
--- /dev/null
+++ b/llgo/test/execution/chan/self.go
@@ -0,0 +1,20 @@
+// RUN: llgo -o %t %s
+// RUN: %t 2>&1 | FileCheck %s
+
+// CHECK: 1
+// CHECK-NEXT: 2
+// CHECK-NEXT: true
+
+package main
+
+func main() {
+ ch := make(chan int, uint8(1))
+
+ ch <- 1
+ println(<-ch)
+
+ ch <- 2
+ x, ok := <-ch
+ println(x)
+ println(ok)
+}
OpenPOWER on IntegriCloud