aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/v/checker/tests/go_wait_or.vv
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/old/vlib/v/checker/tests/go_wait_or.vv')
-rw-r--r--v_windows/v/old/vlib/v/checker/tests/go_wait_or.vv41
1 files changed, 41 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/v/checker/tests/go_wait_or.vv b/v_windows/v/old/vlib/v/checker/tests/go_wait_or.vv
new file mode 100644
index 0000000..3522f90
--- /dev/null
+++ b/v_windows/v/old/vlib/v/checker/tests/go_wait_or.vv
@@ -0,0 +1,41 @@
+fn d(n int) f64 { return f64(n) }
+fn e(n int) { }
+fn f(n int) ?f64 { return f64(n) }
+fn g(n int) ? { }
+
+fn main() {
+ tg := [
+ go d(0)
+ go d(1)
+ ]
+ r := tg.wait() ?
+ println(r)
+ s := tg[0].wait() or { panic('problem') }
+ println(s)
+ tg2 := [
+ go e(0)
+ go e(1)
+ ]
+ tg2.wait() or { panic('problem') }
+ tg2[0].wait() ?
+ tg3 := [
+ go f(0)
+ go f(1)
+ ]
+ tg3.wait() or { panic('problem') }
+ for t in tg3 {
+ a := t.wait()
+ println(a)
+ }
+ for i, _ in tg3 {
+ a := tg3[i].wait()
+ println(a)
+ }
+ tg4 := [
+ go g(0)
+ go g(1)
+ ]
+ tg4.wait()
+ tg4[0].wait()
+ go g(3) or { panic('problem') }
+}