summary refs log tree commit diff stats
path: root/tests/caas/absurd_nesting.nim
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2013-06-16 22:35:54 +0200
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2013-06-16 22:39:38 +0200
commita1da2b713bccbf9555f087caeb4e093e445952f5 (patch)
treed93579e88a3866ec5256b2298365607dd1017465 /tests/caas/absurd_nesting.nim
parent1f8c5c37d38f4f4a8f9651e5a6ca699fc08ba53d (diff)
downloadNim-a1da2b713bccbf9555f087caeb4e093e445952f5.tar.gz
Adds idetools hierarchy nesting test.
Diffstat (limited to 'tests/caas/absurd_nesting.nim')
-rw-r--r--tests/caas/absurd_nesting.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/caas/absurd_nesting.nim b/tests/caas/absurd_nesting.nim
new file mode 100644
index 000000000..136d65cc7
--- /dev/null
+++ b/tests/caas/absurd_nesting.nim
@@ -0,0 +1,29 @@
+# Tries to test the full ownership path generated by idetools.
+
+proc lev1(t1: string) =
+  var temp = t1
+  for i in 0..len(temp)-1:
+    temp[i] = chr(int(temp[i]) + 1)
+
+  proc lev2(t2: string) =
+    var temp = t2
+    for i in 0..len(temp)-1:
+      temp[i] = chr(int(temp[i]) + 1)
+
+    proc lev3(t3: string) =
+      var temp = t3
+      for i in 0..len(temp)-1:
+        temp[i] = chr(int(temp[i]) + 1)
+
+      proc lev4(t4: string) =
+        var temp = t4
+        for i in 0..len(temp)-1:
+          temp[i] = chr(int(temp[i]) + 1)
+
+        echo temp & "(lev4)"
+      lev4(temp & "(lev3)")
+    lev3(temp & "(lev2)")
+  lev2(temp & "(lev1)")
+
+when isMainModule:
+  lev1("abcd")