summary refs log tree commit diff stats
path: root/nimsuggest/tests/tdot4.nim
blob: e1ff96553a09dcf4c1b8eeb3738736eba8b794c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Test that already used suggestions are prioritized

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