summary refs log tree commit diff stats
path: root/nimsuggest/tests/tdot2.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-03-09 14:58:14 +0100
committerAraq <rumpf_a@web.de>2017-03-09 14:58:14 +0100
commit475579541621ca83cfcbb35df7f5d9ef4236cdfa (patch)
tree81f95f9ae846b61c7f2878a275413f5a3fc9bea3 /nimsuggest/tests/tdot2.nim
parentda821a22d9e390d59f66018630fb4c39ba83eaf3 (diff)
downloadNim-475579541621ca83cfcbb35df7f5d9ef4236cdfa.tar.gz
nimsuggest: more precise cursor tracking
Diffstat (limited to 'nimsuggest/tests/tdot2.nim')
-rw-r--r--nimsuggest/tests/tdot2.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/nimsuggest/tests/tdot2.nim b/nimsuggest/tests/tdot2.nim
new file mode 100644
index 000000000..f02b5cf16
--- /dev/null
+++ b/nimsuggest/tests/tdot2.nim
@@ -0,0 +1,29 @@
+# Test 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;;None
+sug;;skField;;y;;int;;$file;;8;;7;;"";;100;;None
+sug;;skProc;;tdot2.main;;proc (f: Foo);;$file;;12;;5;;"";;100;;None
+!edit 0i32 1i32
+>sug $1
+sug;;skField;;x;;int;;$file;;8;;4;;"";;100;;None
+sug;;skField;;y;;int;;$file;;8;;7;;"";;100;;None
+sug;;skField;;z;;string;;$file;;10;;6;;"";;100;;None
+sug;;skProc;;tdot2.main;;proc (f: Foo);;$file;;12;;5;;"";;100;;None
+"""