summary refs log tree commit diff stats
path: root/tools/nimsuggest/tests/tdot2.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-11-05 10:32:24 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-11-05 10:32:24 +0100
commit162f5ddb7d73f6e5abf284ea1f6b1cc4f68307ab (patch)
tree484f1bc0e481218842b0ec7d8aa6af741756b41f /tools/nimsuggest/tests/tdot2.nim
parent499ae7297bd7d106525a296312d1653e8bf80b7e (diff)
downloadNim-162f5ddb7d73f6e5abf284ea1f6b1cc4f68307ab.tar.gz
nimsuggest tester supports editing of files
Diffstat (limited to 'tools/nimsuggest/tests/tdot2.nim')
-rw-r--r--tools/nimsuggest/tests/tdot2.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/nimsuggest/tests/tdot2.nim b/tools/nimsuggest/tests/tdot2.nim
new file mode 100644
index 000000000..490e78451
--- /dev/null
+++ b/tools/nimsuggest/tests/tdot2.nim
@@ -0,0 +1,29 @@
+# Test that basic editing. We replace the 'false' by 'true' to
+# see whether then the z field is suggested.
+
+const zField = 0i32
+
+type
+  Foo = object
+    x, y: int
+    when zField == 1i32:
+      z: string
+
+proc main(f: Foo) =
+  f.#[!]#
+
+# the tester supports the spec section at the bottom of the file and
+# this way, the line numbers more often stay the same
+discard """
+$nimsuggest --tester $file
+>sug $1
+sug;;skField;;x;;int;;$file;;8;;4;;"";;100
+sug;;skField;;y;;int;;$file;;8;;7;;"";;100
+sug;;skProc;;tdot2.main;;proc (f: Foo);;$file;;12;;5;;"";;100
+!edit 0i32 1i32
+>sug $1
+sug;;skField;;x;;int;;$file;;8;;4;;"";;100
+sug;;skField;;y;;int;;$file;;8;;7;;"";;100
+sug;;skField;;z;;string;;$file;;10;;6;;"";;100
+sug;;skProc;;tdot2.main;;proc (f: Foo);;$file;;12;;5;;"";;100
+"""