summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2015-06-15 21:04:50 +0200
committerAndreas Rumpf <rumpf_a@web.de>2015-06-15 21:04:50 +0200
commit116a60caebec32e4e20e9e4673ff90d2ae5c72f8 (patch)
tree2616fe8639115fea97943f7b1d9596e7f70a0d63 /tests
parent77abb8f8b4875b39b86d4677495e423c54b4936d (diff)
parent80a13a408e39ca197f42398163ef7917a64d1aad (diff)
downloadNim-116a60caebec32e4e20e9e4673ff90d2ae5c72f8.tar.gz
Merge pull request #2856 from fowlmouth/patch-4
made string compatible with openarray[char]
Diffstat (limited to 'tests')
-rw-r--r--tests/typerel/tstr_as_openarray.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/typerel/tstr_as_openarray.nim b/tests/typerel/tstr_as_openarray.nim
new file mode 100644
index 000000000..fc28d6c93
--- /dev/null
+++ b/tests/typerel/tstr_as_openarray.nim
@@ -0,0 +1,22 @@
+discard """
+  output: '''success'''
+"""
+var s = "HI"
+
+proc x (zz: openarray[char]) =
+  discard
+
+x s
+
+proc z [T] (zz: openarray[T]) =
+  discard
+
+z s
+z([s,s,s])
+
+proc y [T] (arg: var openarray[T]) =
+  arg[0] = 'X'
+y s
+doAssert s == "XI"
+
+echo "success"