| 1 |
This test checks the behavior of the 'change quote' code action. |
| 2 |
|
| 3 |
-- flags -- |
| 4 |
-ignore_extra_diags |
| 5 |
|
| 6 |
-- go.mod -- |
| 7 |
module golang.org/lsptests/changequote |
| 8 |
|
| 9 |
go 1.18 |
| 10 |
|
| 11 |
-- a.go -- |
| 12 |
package changequote |
| 13 |
|
| 14 |
import ( |
| 15 |
"fmt" |
| 16 |
) |
| 17 |
|
| 18 |
func foo() { |
| 19 |
var s string |
| 20 |
s = "hello" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a1) |
| 21 |
s = `hello` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a2) |
| 22 |
s = "hello\tworld" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a3) |
| 23 |
s = `hello world` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a4) |
| 24 |
s = "hello\nworld" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a5) |
| 25 |
// add a comment to avoid affect diff compute |
| 26 |
s = `hello |
| 27 |
world` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a6) |
| 28 |
s = "hello\"world" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a7) |
| 29 |
s = `hello"world` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a8) |
| 30 |
s = "hello\x1bworld" //@codeaction(`"`, "refactor.rewrite.changeQuote", err=re"found 0 CodeActions") |
| 31 |
s = "hello`world" //@codeaction(`"`, "refactor.rewrite.changeQuote", err=re"found 0 CodeActions") |
| 32 |
s = "hello\x7fworld" //@codeaction(`"`, "refactor.rewrite.changeQuote", err=re"found 0 CodeActions") |
| 33 |
fmt.Println(s) |
| 34 |
} |
| 35 |
|
| 36 |
-- @a1/a.go -- |
| 37 |
@@ -9 +9 @@ |
| 38 |
- s = "hello" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a1) |
| 39 |
+ s = `hello` //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a1) |
| 40 |
-- @a2/a.go -- |
| 41 |
@@ -10 +10 @@ |
| 42 |
- s = `hello` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a2) |
| 43 |
+ s = "hello" //@codeaction("`", "refactor.rewrite.changeQuote", edit=a2) |
| 44 |
-- @a3/a.go -- |
| 45 |
@@ -11 +11 @@ |
| 46 |
- s = "hello\tworld" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a3) |
| 47 |
+ s = `hello world` //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a3) |
| 48 |
-- @a4/a.go -- |
| 49 |
@@ -12 +12 @@ |
| 50 |
- s = `hello world` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a4) |
| 51 |
+ s = "hello\tworld" //@codeaction("`", "refactor.rewrite.changeQuote", edit=a4) |
| 52 |
-- @a5/a.go -- |
| 53 |
@@ -13 +13,2 @@ |
| 54 |
- s = "hello\nworld" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a5) |
| 55 |
+ s = `hello |
| 56 |
+world` //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a5) |
| 57 |
-- @a6/a.go -- |
| 58 |
@@ -15,2 +15 @@ |
| 59 |
- s = `hello |
| 60 |
-world` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a6) |
| 61 |
+ s = "hello\nworld" //@codeaction("`", "refactor.rewrite.changeQuote", edit=a6) |
| 62 |
-- @a7/a.go -- |
| 63 |
@@ -17 +17 @@ |
| 64 |
- s = "hello\"world" //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a7) |
| 65 |
+ s = `hello"world` //@codeaction(`"`, "refactor.rewrite.changeQuote", edit=a7) |
| 66 |
-- @a8/a.go -- |
| 67 |
@@ -18 +18 @@ |
| 68 |
- s = `hello"world` //@codeaction("`", "refactor.rewrite.changeQuote", edit=a8) |
| 69 |
+ s = "hello\"world" //@codeaction("`", "refactor.rewrite.changeQuote", edit=a8) |