blob: d29694e835fc43c01d05d526e50baad7d613e82d [file] [log] [blame]
Muir Manders09058ab2020-11-23 11:51:45 -08001package snippets
2
3// These tests check that postfix completions do and do not show up in
4// certain cases. Tests for the postfix completion contents are under
5// regtest.
6
7func _() {
8 /* append! */ //@item(postfixAppend, "append!", "append and re-assign slice", "snippet")
9 var foo []int
10 foo.append //@rank(" //", postfixAppend)
11
12 []int{}.append //@complete(" //")
13
14 []int{}.last //@complete(" //")
15
16 /* copy! */ //@item(postfixCopy, "copy!", "duplicate slice", "snippet")
17
18 foo.copy //@rank(" //", postfixCopy)
19
20 var s struct{ i []int }
21 s.i.copy //@rank(" //", postfixCopy)
22
23 var _ []int = s.i.copy //@complete(" //")
24
25 var blah func() []int
26 blah().append //@complete(" //")
27}
Muir Manders716a04c2021-04-23 15:10:27 -070028
29func _() {
30 /* append! */ //@item(postfixAppend, "append!", "append and re-assign slice", "snippet")
31 /* last! */ //@item(postfixLast, "last!", "s[len(s)-1]", "snippet")
32 /* print! */ //@item(postfixPrint, "print!", "print to stdout", "snippet")
33 /* range! */ //@item(postfixRange, "range!", "range over slice", "snippet")
34 /* reverse! */ //@item(postfixReverse, "reverse!", "reverse slice", "snippet")
35 /* sort! */ //@item(postfixSort, "sort!", "sort.Slice()", "snippet")
36 /* var! */ //@item(postfixVar, "var!", "assign to variable", "snippet")
37
38 var foo []int
39 foo. //@complete(" //", postfixAppend, postfixCopy, postfixLast, postfixPrint, postfixRange, postfixReverse, postfixSort, postfixVar)
40
41 foo = nil
42}