summary refs log tree commit diff stats
path: root/tests/isolate/tisolate.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/isolate/tisolate.nim')
-rw-r--r--tests/isolate/tisolate.nim41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/isolate/tisolate.nim b/tests/isolate/tisolate.nim
new file mode 100644
index 000000000..a0e71e321
--- /dev/null
+++ b/tests/isolate/tisolate.nim
@@ -0,0 +1,41 @@
+discard """
+  errormsg: "expression cannot be isolated: select(a, b)"
+  line: 39
+"""
+
+import std / isolation
+
+import json, streams
+
+proc myParseJson(s: Stream; filename: string): JsonNode =
+  {.cast(noSideEffect).}:
+    result = parseJson(s, filename)
+
+
+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 myParseJson(newFileStream("my.json"), "my.json")
+
+  var a, b: Node
+  discard isolate select(a, b)
+
+main()