]> Nishi Git Mirror - gwion.git/commitdiff
:white_check_mark: test forks
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Wed, 6 May 2020 17:38:46 +0000 (19:38 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Wed, 6 May 2020 17:38:46 +0000 (19:38 +0200)
tests/fork/fork.gw [new file with mode: 0644]
tests/fork/fork_clean.gw [new file with mode: 0644]
tests/fork/fork_in_fork.gw [new file with mode: 0644]
tests/fork/fork_join.gw [new file with mode: 0644]
tests/fork/fork_join2.gw [new file with mode: 0644]

diff --git a/tests/fork/fork.gw b/tests/fork/fork.gw
new file mode 100644 (file)
index 0000000..63256ea
--- /dev/null
@@ -0,0 +1,11 @@
+fork {
+  <<< "start" >>>;
+  12::samp => now;
+  me.test_cancel();
+  <<< "stop" >>>;
+} @=> Fork ref f;
+
+1 => f.set_cancel;
+2::samp => now;
+0 => f.set_cancel;
+f.join();
diff --git a/tests/fork/fork_clean.gw b/tests/fork/fork_clean.gw
new file mode 100644 (file)
index 0000000..4e6877b
--- /dev/null
@@ -0,0 +1 @@
+fork { <<< __func__ >>>; second => now; };
diff --git a/tests/fork/fork_in_fork.gw b/tests/fork/fork_in_fork.gw
new file mode 100644 (file)
index 0000000..f75af95
--- /dev/null
@@ -0,0 +1,10 @@
+fork {
+  fork {
+    <<< __func__ >>>;
+    second => now;
+  };
+  <<< __func__ >>>;
+  second => now;
+};
+
+samp => now;
diff --git a/tests/fork/fork_join.gw b/tests/fork/fork_join.gw
new file mode 100644 (file)
index 0000000..e0b85d7
--- /dev/null
@@ -0,0 +1,3 @@
+fork { <<< __func__ >>>; } @=> Fork ref f;
+second => now;
+f.join();
diff --git a/tests/fork/fork_join2.gw b/tests/fork/fork_join2.gw
new file mode 100644 (file)
index 0000000..dd8d58f
--- /dev/null
@@ -0,0 +1,2 @@
+fork { <<< __func__ >>>; minute => now; } @=> Fork ref f;
+f.join();