| 1 |
This test checks the behavior of the 'remove dot import' code action. |
| 2 |
|
| 3 |
-- go.mod -- |
| 4 |
module example.com |
| 5 |
|
| 6 |
go 1.18 |
| 7 |
|
| 8 |
-- a.go -- |
| 9 |
package dotimport |
| 10 |
|
| 11 |
// Base case: action is OK. |
| 12 |
|
| 13 |
import ( |
| 14 |
. "fmt" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a1) |
| 15 |
. "bytes" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a2) |
| 16 |
. "time" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a3) |
| 17 |
) |
| 18 |
|
| 19 |
var _ = a |
| 20 |
|
| 21 |
func a() { |
| 22 |
Println("hello") |
| 23 |
|
| 24 |
buf := NewBuffer(nil) |
| 25 |
buf.Grow(10) |
| 26 |
|
| 27 |
_ = Ticker{C: nil} |
| 28 |
} |
| 29 |
|
| 30 |
-- @a1/a.go -- |
| 31 |
@@ -6 +6 @@ |
| 32 |
- . "fmt" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a1) |
| 33 |
+ "fmt" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a1) |
| 34 |
@@ -14 +14 @@ |
| 35 |
- Println("hello") |
| 36 |
+ fmt.Println("hello") |
| 37 |
-- @a2/a.go -- |
| 38 |
@@ -7 +7 @@ |
| 39 |
- . "bytes" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a2) |
| 40 |
+ "bytes" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a2) |
| 41 |
@@ -16 +16 @@ |
| 42 |
- buf := NewBuffer(nil) |
| 43 |
+ buf := bytes.NewBuffer(nil) |
| 44 |
-- @a3/a.go -- |
| 45 |
@@ -8 +8 @@ |
| 46 |
- . "time" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a3) |
| 47 |
+ "time" //@codeaction(`.`, "refactor.rewrite.eliminateDotImport", edit=a3) |
| 48 |
@@ -19 +19 @@ |
| 49 |
- _ = Ticker{C: nil} |
| 50 |
+ _ = time.Ticker{C: nil} |