summary refs log tree commit diff stats
path: root/tools/nimsuggest/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-03-08 00:38:48 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-03-08 00:38:48 +0100
commit91a4b448fdfb1a28e5bd1f1d5785e0308fedcb1a (patch)
tree9d34b447df1bf08f7207a82c5f4fdc65a619c006 /tools/nimsuggest/tests
parent538c6c98985399314a845617e566313b70ac71e4 (diff)
downloadNim-91a4b448fdfb1a28e5bd1f1d5785e0308fedcb1a.tar.gz
nimsuggest: chk checks the full project lazily; much better suggestions orderings
Diffstat (limited to 'tools/nimsuggest/tests')
-rw-r--r--tools/nimsuggest/tests/tno_deref.nim2
-rw-r--r--tools/nimsuggest/tests/tsug_regression.nim28
-rw-r--r--tools/nimsuggest/tests/twithin_macro.nim12
-rw-r--r--tools/nimsuggest/tests/twithin_macro_prefix.nim4
4 files changed, 37 insertions, 9 deletions
diff --git a/tools/nimsuggest/tests/tno_deref.nim b/tools/nimsuggest/tests/tno_deref.nim
index 0f8ba3bd8..05cffa507 100644
--- a/tools/nimsuggest/tests/tno_deref.nim
+++ b/tools/nimsuggest/tests/tno_deref.nim
@@ -9,6 +9,6 @@ x.#[!]#
 discard """
 $nimsuggest --tester $file
 >sug $1
-sug;;skProc;;tno_deref.foo;;proc (y: ptr int)*;;$file;;4;;5;;"";;100
+sug;;skProc;;tno_deref.foo;;proc (y: ptr int)*;;$file;;4;;5;;"";;100;;None
 *
 """
diff --git a/tools/nimsuggest/tests/tsug_regression.nim b/tools/nimsuggest/tests/tsug_regression.nim
new file mode 100644
index 000000000..1e440db2d
--- /dev/null
+++ b/tools/nimsuggest/tests/tsug_regression.nim
@@ -0,0 +1,28 @@
+# test we only get suggestions, not error messages:
+
+import tables, sets, parsecfg
+
+type X = object
+
+proc main =
+  # bug #52
+  var
+    set0 = initSet[int]()
+    set1 = initSet[X]()
+    set2 = initSet[ref int]()
+
+    map0 = initTable[int, int]()
+    map1 = initOrderedTable[string, int]()
+    cfg = loadConfig("file")
+  map0.#[!]#
+
+discard """
+$nimsuggest --tester $file
+>sug $1
+sug;;skProc;;tables.getOrDefault;;proc (t: Table[getOrDefault.A, getOrDefault.B], key: A): B;;$lib/pure/collections/tables.nim;;178;;5;;"";;100;;None
+sug;;skProc;;tables.hasKey;;proc (t: Table[hasKey.A, hasKey.B], key: A): bool;;$lib/pure/collections/tables.nim;;233;;5;;"returns true iff `key` is in the table `t`.";;100;;None
+sug;;skProc;;tables.add;;proc (t: var Table[add.A, add.B], key: A, val: B);;$lib/pure/collections/tables.nim;;297;;5;;"puts a new (key, value)-pair into `t` even if ``t[key]`` already exists.";;100;;None
+sug;;skIterator;;tables.allValues;;iterator (t: Table[allValues.A, allValues.B], key: A): B{.inline.};;$lib/pure/collections/tables.nim;;225;;9;;"iterates over any value in the table `t` that belongs to the given `key`.";;100;;None
+sug;;skProc;;tables.clear;;proc (t: var Table[clear.A, clear.B]);;$lib/pure/collections/tables.nim;;121;;5;;"Resets the table so that it is empty.";;100;;None
+*
+"""
diff --git a/tools/nimsuggest/tests/twithin_macro.nim b/tools/nimsuggest/tests/twithin_macro.nim
index 7392dd605..e0df03542 100644
--- a/tools/nimsuggest/tests/twithin_macro.nim
+++ b/tools/nimsuggest/tests/twithin_macro.nim
@@ -204,10 +204,10 @@ echo r
 discard """
 $nimsuggest --tester $file
 >sug $1
-sug;;skField;;name;;string;;$file;;166;;6;;"";;100
-sug;;skField;;age;;int;;$file;;167;;6;;"";;100
-sug;;skMethod;;twithin_macro.age_human_yrs;;proc (self: Animal): int;;$file;;169;;9;;"";;100
-sug;;skMacro;;twithin_macro.class;;proc (head: untyped, body: untyped): untyped{.gcsafe, locks: <unknown>.};;$file;;4;;6;;"Iterates over the children of the NimNode ``n``.";;100
-sug;;skMethod;;twithin_macro.vocalize;;proc (self: Animal): string;;$file;;168;;9;;"";;100
-sug;;skMethod;;twithin_macro.vocalize;;proc (self: Rabbit): string;;$file;;184;;9;;"";;100*
+sug;;skField;;age;;int;;$file;;167;;6;;"";;100;;None
+sug;;skField;;name;;string;;$file;;166;;6;;"";;100;;None
+sug;;skMethod;;twithin_macro.age_human_yrs;;proc (self: Animal): int;;$file;;169;;9;;"";;100;;None
+sug;;skMethod;;twithin_macro.vocalize;;proc (self: Animal): string;;$file;;168;;9;;"";;100;;None
+sug;;skMethod;;twithin_macro.vocalize;;proc (self: Rabbit): string;;$file;;184;;9;;"";;100;;None
+sug;;skMacro;;twithin_macro.class;;proc (head: untyped, body: untyped): untyped{.gcsafe, locks: <unknown>.};;$file;;4;;6;;"";;50;;None*
 """
diff --git a/tools/nimsuggest/tests/twithin_macro_prefix.nim b/tools/nimsuggest/tests/twithin_macro_prefix.nim
index 6ee9fb2dc..86e406c5d 100644
--- a/tools/nimsuggest/tests/twithin_macro_prefix.nim
+++ b/tools/nimsuggest/tests/twithin_macro_prefix.nim
@@ -204,6 +204,6 @@ echo r
 discard """
 $nimsuggest --tester $file
 >sug $1
-sug;;skField;;age;;int;;$file;;167;;6;;"";;100
-sug;;skMethod;;twithin_macro_prefix.age_human_yrs;;proc (self: Animal): int;;$file;;169;;9;;"";;100
+sug;;skField;;age;;int;;$file;;167;;6;;"";;100;;Prefix
+sug;;skMethod;;twithin_macro_prefix.age_human_yrs;;proc (self: Animal): int;;$file;;169;;9;;"";;100;;Prefix
 """