golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/codeaction/change_quote.txt (about)

     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" //@codeactionedit(`"`, "refactor.rewrite", a1, "Convert to raw string literal")
    21  	s = `hello` //@codeactionedit("`", "refactor.rewrite", a2, "Convert to interpreted string literal")
    22  	s = "hello\tworld" //@codeactionedit(`"`, "refactor.rewrite", a3, "Convert to raw string literal")
    23  	s = `hello	world` //@codeactionedit("`", "refactor.rewrite", a4, "Convert to interpreted string literal")
    24  	s = "hello\nworld" //@codeactionedit(`"`, "refactor.rewrite", a5, "Convert to raw string literal")
    25  	// add a comment  to avoid affect diff compute
    26  	s = `hello
    27  world` //@codeactionedit("`", "refactor.rewrite", a6, "Convert to interpreted string literal")
    28  	s = "hello\"world" //@codeactionedit(`"`, "refactor.rewrite", a7, "Convert to raw string literal")
    29  	s = `hello"world` //@codeactionedit("`", "refactor.rewrite", a8, "Convert to interpreted string literal")
    30  	s = "hello\x1bworld" //@codeactionerr(`"`, "", "refactor.rewrite", re"found 0 CodeActions")
    31  	s = "hello`world" //@codeactionerr(`"`, "", "refactor.rewrite", re"found 0 CodeActions")
    32  	s = "hello\x7fworld" //@codeactionerr(`"`, "", "refactor.rewrite", re"found 0 CodeActions")
    33  	fmt.Println(s)
    34  }
    35  
    36  -- @a1/a.go --
    37  @@ -9 +9 @@
    38  -	s = "hello" //@codeactionedit(`"`, "refactor.rewrite", a1, "Convert to raw string literal")
    39  +	s = `hello` //@codeactionedit(`"`, "refactor.rewrite", a1, "Convert to raw string literal")
    40  -- @a2/a.go --
    41  @@ -10 +10 @@
    42  -	s = `hello` //@codeactionedit("`", "refactor.rewrite", a2, "Convert to interpreted string literal")
    43  +	s = "hello" //@codeactionedit("`", "refactor.rewrite", a2, "Convert to interpreted string literal")
    44  -- @a3/a.go --
    45  @@ -11 +11 @@
    46  -	s = "hello\tworld" //@codeactionedit(`"`, "refactor.rewrite", a3, "Convert to raw string literal")
    47  +	s = `hello	world` //@codeactionedit(`"`, "refactor.rewrite", a3, "Convert to raw string literal")
    48  -- @a4/a.go --
    49  @@ -12 +12 @@
    50  -	s = `hello	world` //@codeactionedit("`", "refactor.rewrite", a4, "Convert to interpreted string literal")
    51  +	s = "hello\tworld" //@codeactionedit("`", "refactor.rewrite", a4, "Convert to interpreted string literal")
    52  -- @a5/a.go --
    53  @@ -13 +13,2 @@
    54  -	s = "hello\nworld" //@codeactionedit(`"`, "refactor.rewrite", a5, "Convert to raw string literal")
    55  +	s = `hello
    56  +world` //@codeactionedit(`"`, "refactor.rewrite", a5, "Convert to raw string literal")
    57  -- @a6/a.go --
    58  @@ -15,2 +15 @@
    59  -	s = `hello
    60  -world` //@codeactionedit("`", "refactor.rewrite", a6, "Convert to interpreted string literal")
    61  +	s = "hello\nworld" //@codeactionedit("`", "refactor.rewrite", a6, "Convert to interpreted string literal")
    62  -- @a7/a.go --
    63  @@ -17 +17 @@
    64  -	s = "hello\"world" //@codeactionedit(`"`, "refactor.rewrite", a7, "Convert to raw string literal")
    65  +	s = `hello"world` //@codeactionedit(`"`, "refactor.rewrite", a7, "Convert to raw string literal")
    66  -- @a8/a.go --
    67  @@ -18 +18 @@
    68  -	s = `hello"world` //@codeactionedit("`", "refactor.rewrite", a8, "Convert to interpreted string literal")
    69  +	s = "hello\"world" //@codeactionedit("`", "refactor.rewrite", a8, "Convert to interpreted string literal")