| 1 |
This test checks selection range functionality. |
| 2 |
|
| 3 |
-- foo.go -- |
| 4 |
package foo |
| 5 |
|
| 6 |
import "time" |
| 7 |
|
| 8 |
func Bar(x, y int, t time.Time) int { |
| 9 |
zs := []int{1, 2, 3} //@selectionrange("1", a) |
| 10 |
|
| 11 |
for _, z := range zs { |
| 12 |
x = x + z + y + zs[1] //@selectionrange("1", b) |
| 13 |
} |
| 14 |
|
| 15 |
return x + y //@selectionrange("+", c) |
| 16 |
} |
| 17 |
-- @a -- |
| 18 |
Ranges 0: |
| 19 |
5:13-5:14 "1" |
| 20 |
5:7-5:21 "[]int{1, 2, 3}" |
| 21 |
5:1-5:21 "zs := []int{1, 2, 3}" |
| 22 |
4:36-12:1 "{\\n\tzs := []int{...range(\"+\", c)\\n}" |
| 23 |
4:0-12:1 "func Bar(x, y i...range(\"+\", c)\\n}" |
| 24 |
0:0-12:1 "package foo\\n\\nim...range(\"+\", c)\\n}" |
| 25 |
-- @b -- |
| 26 |
Ranges 0: |
| 27 |
8:21-8:22 "1" |
| 28 |
8:18-8:23 "zs[1]" |
| 29 |
8:6-8:23 "x + z + y + zs[1]" |
| 30 |
8:2-8:23 "x = x + z + y + zs[1]" |
| 31 |
7:22-9:2 "{\\n\t\tx = x + z +...ange(\"1\", b)\\n\t}" |
| 32 |
7:1-9:2 "for _, z := ran...ange(\"1\", b)\\n\t}" |
| 33 |
4:36-12:1 "{\\n\tzs := []int{...range(\"+\", c)\\n}" |
| 34 |
4:0-12:1 "func Bar(x, y i...range(\"+\", c)\\n}" |
| 35 |
0:0-12:1 "package foo\\n\\nim...range(\"+\", c)\\n}" |
| 36 |
-- @c -- |
| 37 |
Ranges 0: |
| 38 |
11:8-11:13 "x + y" |
| 39 |
11:1-11:13 "return x + y" |
| 40 |
4:36-12:1 "{\\n\tzs := []int{...range(\"+\", c)\\n}" |
| 41 |
4:0-12:1 "func Bar(x, y i...range(\"+\", c)\\n}" |
| 42 |
0:0-12:1 "package foo\\n\\nim...range(\"+\", c)\\n}" |