diff --git a/go/analysis/analysistest/analysistest.go b/go/analysis/analysistest/analysistest.go index fc06c322694..74043c59de0 100644 --- a/go/analysis/analysistest/analysistest.go +++ b/go/analysis/analysistest/analysistest.go @@ -193,11 +193,13 @@ func check(t Testing, gopath string, pass *analysis.Pass, diagnostics []analysis for _, c := range cgroup.List { text := strings.TrimPrefix(c.Text, "//") - if text == c.Text { - continue // not a //-comment + if text == c.Text { // not a //-comment. + text = strings.TrimPrefix(text, "/*") + text = strings.TrimSuffix(text, "*/") } // Hack: treat a comment of the form "//...// want..." + // or "/*...// want... */ // as if it starts at 'want'. // This allows us to add comments on comments, // as required when testing the buildtag analyzer. diff --git a/go/analysis/analysistest/analysistest_test.go b/go/analysis/analysistest/analysistest_test.go index c16e5079e22..f5a003c62b6 100644 --- a/go/analysis/analysistest/analysistest_test.go +++ b/go/analysis/analysistest/analysistest_test.go @@ -54,6 +54,15 @@ func main() { // OK println("hello, world") // want "call of println" + // OK /* */-form. + println("안녕, 세계") /* want "call of println" */ + + // OK (nested comment) + println("Γειά σου, Κόσμε") // some comment // want "call of println" + + // OK (nested comment in /**/) + println("你好,世界") /* some comment // want "call of println" */ + // OK (multiple expectations on same line) println(); println() // want "call of println(...)" "call of println(...)" }