summary refs log tree commit diff stats
path: root/tests/isolate/tisolate.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2020-07-20 07:50:19 +0200
committerGitHub <noreply@github.com>2020-07-20 07:50:19 +0200
commit71dd5f85b9a13d97ea0c74338722bf08a9ae6286 (patch)
tree0c8757d1a835b334bcac8dc252622bd7b9073549 /tests/isolate/tisolate.nim
parentbb1adf6a706190883fa57a0208ba8e3118235256 (diff)
downloadNim-71dd5f85b9a13d97ea0c74338722bf08a9ae6286.tar.gz
'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011)
Diffstat (limited to 'tests/isolate/tisolate.nim')
-rw-r--r--tests/isolate/tisolate.nim36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/isolate/tisolate.nim b/tests/isolate/tisolate.nim
new file mode 100644
index 000000000..9f3b15441
--- /dev/null
+++ b/tests/isolate/tisolate.nim
@@ -0,0 +1,36 @@
+discard """
+  errormsg: "expression cannot be isolated: select(a, b)"
+  line: 34
+"""
+
+import std / isolation
+
+import json, streams
+
+proc f(): seq[int] =
+  @[1, 2, 3]
+
+type
+  Node = ref object
+    x: string
+
+proc g(): Node = nil
+
+proc select(a, b: Node): Node =
+  a
+
+proc main =
+  discard isolate f()
+
+
+  discard isolate g()
+
+  discard isolate select(Node(x: "a"), nil)
+  discard isolate select(Node(x: "a"), Node(x: "b"))
+
+  discard isolate parseJson(newFileStream("my.json"), "my.json")
+
+  var a, b: Node
+  discard isolate select(a, b)
+
+main()