Skip to content

Commit

Permalink
chore: Add test for rangefunc (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
varungandhi-src authored Aug 14, 2024
1 parent 4fc9085 commit e286bd4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/testdata/snapshots/input/initial/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module sg/initial

go 1.19
go 1.23
12 changes: 12 additions & 0 deletions internal/testdata/snapshots/input/initial/rangefunc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package initial

import (
"slices"
)

func f(xs []int) int {
for _, x := range slices.All(xs) {
return x
}
return -1
}
23 changes: 23 additions & 0 deletions internal/testdata/snapshots/output/initial/rangefunc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package initial
// ^^^^^^^ reference 0.1.test `sg/initial`/

import (
"slices"
// ^^^^^^ reference github.com/golang/go/src go1.22 slices/
)

func f(xs []int) int {
// ^ definition 0.1.test `sg/initial`/f().
// documentation ```go
// ^^ definition local 0
for _, x := range slices.All(xs) {
// ^ definition local 1
// ^^^^^^ reference github.com/golang/go/src go1.22 slices/
// ^^^ reference github.com/golang/go/src go1.22 slices/All().
// ^^ reference local 0
return x
// ^ reference local 1
}
return -1
}

0 comments on commit e286bd4

Please sign in to comment.