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
This commit is contained in:
parent
fa1a04188f
commit
4cf605dcf6
19 changed files with 292 additions and 376 deletions
|
|
@ -1,17 +1,21 @@
|
|||
discard """
|
||||
disabled:true
|
||||
$nimsuggest --tester --maxresults:2 $file
|
||||
>sug $1
|
||||
sug;;skProc;;tdot4.main;;proc (inp: string): string;;$file;;10;;5;;"";;100;;None
|
||||
sug;;skProc;;strutils.replace;;proc (s: string, sub: string, by: string): string{.noSideEffect, gcsafe, locks: 0.};;$lib/pure/strutils.nim;;1506;;5;;"Replaces `sub` in `s` by the string `by`.";;100;;None
|
||||
"""
|
||||
# Test that already used suggestions are prioritized
|
||||
|
||||
import strutils
|
||||
from system import string, echo
|
||||
import fixtures/mstrutils
|
||||
|
||||
proc main(inp: string): string =
|
||||
# use replace here and see if it occurs in the result, it should gain
|
||||
# priority:
|
||||
result = inp.replace(" ", "a").replace("b", "c")
|
||||
|
||||
|
||||
echo "string literal here".#[!]#
|
||||
|
||||
# priority still tested, but limit results to avoid failures from other output
|
||||
discard """
|
||||
$nimsuggest --tester --maxresults:2 $file
|
||||
>sug $1
|
||||
sug;;skProc;;tdot4.main;;proc (inp: string): string;;$file;;6;;5;;"";;100;;None
|
||||
sug;;skFunc;;mstrutils.replace;;proc (s: string, sub: string, by: string): string{.noSideEffect, gcsafe, locks: 0.};;*fixtures/mstrutils.nim;;9;;5;;"this is a test version of strutils.replace, it simply returns `by`";;100;;None
|
||||
"""
|
||||
|
||||
# TODO - determine appropriate behaviour for further suggest output and test it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue