1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:04:44 -07:00

internal/lsp: test adding imports for package statements with comments

Test that having a comment at the start of a file allows imports
to be added correctly.

Updates golang/go#33721

Change-Id: Id1673c2509537413710b73261ad2a59afe06b93f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/190800
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
This commit is contained in:
Suzy Mueller 2019-08-19 12:43:15 -04:00
parent d308a98e2e
commit 15fda70baf

View File

@ -84,10 +84,36 @@ import (
},
},
{
name: "package statement comments",
// Issue 33721: add import statement after package declaration preceded by comments.
name: "issue 33721 package statement comments before",
pkg: "os",
in: `// This is a comment
package main // This too`,
in: `// Here is a comment before
package main
`,
want: []importInfo{
importInfo{
name: "",
path: "os",
},
},
},
{
name: "package statement comments same line",
pkg: "os",
in: `package main // Here is a comment after
`,
want: []importInfo{
importInfo{
name: "",
path: "os",
},
},
},
{
name: "package statement comments before and after",
pkg: "os",
in: `// Here is a comment before
package main // Here is a comment after`,
want: []importInfo{
importInfo{
name: "",