| 1 | // Copyright (c) 2021, Daniel Martà <[email protected]> |
| 2 | // See LICENSE for licensing information |
| 3 | |
| 4 | package format_testscip-go gomod mvdan.cc/gofumpt . `mvdan.cc/gofumpt/format_test`/ |
| 5 | |
| 6 | import ( |
| 7 | "testingscip-go gomod github.com/golang/go/src go1.20 testing/" |
| 8 | |
| 9 | qtscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/ "github.com/frankban/quicktestscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/" |
| 10 | |
| 11 | "mvdan.cc/gofumpt/formatscip-go gomod mvdan.cc/gofumpt . `mvdan.cc/gofumpt/format`/" |
| 12 | ) |
| 13 | |
| 14 | func TestSourceIncludesSimplifyscip-go gomod mvdan.cc/gofumpt . `mvdan.cc/gofumpt/format_test`/TestSourceIncludesSimplify().(t *testingscip-go gomod github.com/golang/go/src go1.20 testing/.Tscip-go gomod github.com/golang/go/src go1.20 testing/T#) { |
| 15 | t.Parallelscip-go gomod github.com/golang/go/src go1.20 testing/T#Parallel().() |
| 16 | |
| 17 | in := []byte(` |
| 18 | package p |
| 19 | |
| 20 | var () |
| 21 | |
| 22 | func f() { |
| 23 | for _ = range v { |
| 24 | } |
| 25 | } |
| 26 | `[1:]) |
| 27 | want := []byte(` |
| 28 | package p |
| 29 | |
| 30 | func f() { |
| 31 | for range v { |
| 32 | } |
| 33 | } |
| 34 | `[1:]) |
| 35 | got, err := formatscip-go gomod mvdan.cc/gofumpt . `mvdan.cc/gofumpt/format`/.Sourcescip-go gomod mvdan.cc/gofumpt . `mvdan.cc/gofumpt/format`/Source().(in, formatscip-go gomod mvdan.cc/gofumpt . `mvdan.cc/gofumpt/format`/.Optionsscip-go gomod mvdan.cc/gofumpt . `mvdan.cc/gofumpt/format`/Options#{}) |
| 36 | qtscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/.Assertscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/Assert().(t, err, qtscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/.IsNilscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/IsNil.) |
| 37 | qtscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/.Assertscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/Assert().(t, string(got), qtscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/.Equalsscip-go gomod github.com/frankban/quicktest v1.14.6 `github.com/frankban/quicktest`/Equals., string(want)) |
| 38 | } |