summary refs log tree commit diff stats
path: root/nimsuggest/tests/tdef2.nim
diff options
context:
space:
mode:
authorSaem Ghani <saemghani+github@gmail.com>2020-12-27 01:08:28 -0800
committerGitHub <noreply@github.com>2020-12-27 10:08:28 +0100
commit4cf605dcf6bdeacbb3f2ff8c7f17f5ff1afbe316 (patch)
tree3d4bef026ac96f0d4cf2bc5c0e8a3f51da6229b8 /nimsuggest/tests/tdef2.nim
parentfa1a04188ffdc66f1edc909e5b465e548532617a (diff)
downloadNim-4cf605dcf6bdeacbb3f2ff8c7f17f5ff1afbe316.tar.gz
nimsuggest: fix and re-enable old tests (#16401)
A number of nimsuggest tests were disabled for various reasons, sometimes due
to brittleness. These tests have been fixed where needed and most have are now
enabled -- details below. The updates are meant to provide better regression
coverage for future nimsuggest improvements. To avoid brittleness some tests
were refactored.

Impact:
* test coverage has now increased
* faster execution of the test suite
* tests are less likely to break due to stdlib changes

Re-enabled Test & Test Description:
* `tchk1.nim`: check (chk) via nimsuggest works at end of file
* `tdot4.nim`: prioritize already used completion
* `tinclude.nim`: definition lookup (def) with includes
* `tstrutils.nim` -> `tdef2.nim`: test template definition lookup (def)
* `tsug_regression.nim`: regression test for [nimsuggest #52](https://github.com/nim-lang/nimsuggest/issues/52)
* `ttemplate_highlight.nim`: per the file name
* `twithin_macro_prefix.nim`: suggest within a macro with a prefix

Tests Not Re-Enabled:
* `twithin_macro.nim` still disabled as it doesn't provide a good test signal
* EPC highlight tests remain disabled -- requires out of scope tester changes

Additional Notes:
* todos added in comments for follow-up work
Diffstat (limited to 'nimsuggest/tests/tdef2.nim')
-rw-r--r--nimsuggest/tests/tdef2.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/nimsuggest/tests/tdef2.nim b/nimsuggest/tests/tdef2.nim
new file mode 100644
index 000000000..299b83a3d
--- /dev/null
+++ b/nimsuggest/tests/tdef2.nim
@@ -0,0 +1,13 @@
+# Test def with template and boundaries for the cursor
+
+import fixtures/mstrutils
+
+discard """
+$nimsuggest --tester $file
+>def $path/fixtures/mstrutils.nim:6:4
+def;;skTemplate;;mfakeassert.fakeAssert;;template (cond: untyped, msg: string);;*fixtures/mfakeassert.nim;;3;;9;;"template to allow def lookup testing";;100
+>def $path/fixtures/mstrutils.nim:12:3
+def;;skTemplate;;mfakeassert.fakeAssert;;template (cond: untyped, msg: string);;*fixtures/mfakeassert.nim;;3;;9;;"template to allow def lookup testing";;100
+>def $path/fixtures/mstrutils.nim:18:11
+def;;skTemplate;;mfakeassert.fakeAssert;;template (cond: untyped, msg: string);;*fixtures/mfakeassert.nim;;3;;9;;"template to allow def lookup testing";;100
+"""