summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2013-06-14 20:01:57 +0200
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2013-07-02 12:28:22 +0200
commitf7f14081682a24cf110ed7acd907ab2e17834b97 (patch)
treefac65a0e7af938dd3cdd8b45e4b78bb88fa90efa /tests
parent0c18e053365f767366fa17823796930b3458e2a5 (diff)
downloadNim-f7f14081682a24cf110ed7acd907ab2e17834b97.tar.gz
Adds idetools --suggest test case. Refs #484.
1) There are too many suggestions for the given prefix.
2) The suggestions don't take into account the preceeding type.
3) trackDirty only works on caas mode.
Diffstat (limited to 'tests')
-rw-r--r--tests/caas/completion_dot_syntax.txt8
-rw-r--r--tests/caas/completion_dot_syntax_dirty.nim25
-rw-r--r--tests/caas/completion_dot_syntax_main.nim24
3 files changed, 57 insertions, 0 deletions
diff --git a/tests/caas/completion_dot_syntax.txt b/tests/caas/completion_dot_syntax.txt
new file mode 100644
index 000000000..dbffe265c
--- /dev/null
+++ b/tests/caas/completion_dot_syntax.txt
@@ -0,0 +1,8 @@
+completion_dot_syntax_main.nim
+> idetools --track:$TESTNIM,24,15 --def
+def\tskProc\t$MODULE.echoRemainingDollars
+> idetools --trackDirty:completion_dot_syntax_dirty.nim,$TESTNIM,25,12 --suggest
+sug\tskProc\tcompletion_dot_syntax_dirty.echoRemainingDollars
+# The suggestion should not mention the other echoRemaining* variants.
+!sug\tskProc\tcompletion_dot_syntax_dirty.echoRemainingEuros
+!sug\tskProc\tcompletion_dot_syntax_dirty.echoRemainingBugs
diff --git a/tests/caas/completion_dot_syntax_dirty.nim b/tests/caas/completion_dot_syntax_dirty.nim
new file mode 100644
index 000000000..6237c4e79
--- /dev/null
+++ b/tests/caas/completion_dot_syntax_dirty.nim
@@ -0,0 +1,25 @@
+import strutils
+
+# Verifies if the --suggestion switch differentiates types for dot notation.
+
+type
+  TDollar = distinct int
+  TEuro = distinct int
+
+proc echoRemainingDollars(amount: TDollar) =
+  echo "You have $1 dollars" % [$int(amount)]
+
+proc echoRemainingEuros(amount: TEuro) =
+  echo "You have $1 euros" % [$int(amount)]
+
+proc echoRemainingBugs() =
+  echo "You still have bugs"
+
+proc main =
+  var
+    d: TDollar
+    e: TEuro
+  d = TDollar(23)
+  e = TEuro(32)
+  d.echoRemainingDollars()
+  e.echoRemai
diff --git a/tests/caas/completion_dot_syntax_main.nim b/tests/caas/completion_dot_syntax_main.nim
new file mode 100644
index 000000000..0be8c7f4f
--- /dev/null
+++ b/tests/caas/completion_dot_syntax_main.nim
@@ -0,0 +1,24 @@
+import strutils
+
+# Verifies if the --suggestion switch differentiates types for dot notation.
+
+type
+  TDollar = distinct int
+  TEuro = distinct int
+
+proc echoRemainingDollars(amount: TDollar) =
+  echo "You have $1 dollars" % [$int(amount)]
+
+proc echoRemainingEuros(amount: TEuro) =
+  echo "You have $1 euros" % [$int(amount)]
+
+proc echoRemainingBugs() =
+  echo "You still have bugs"
+
+proc main =
+  var
+    d: TDollar
+    e: TEuro
+  d = TDollar(23)
+  e = TEuro(32)
+  d.echoRemainingDollars()