From bfc69a3958c14fb662e71a4fe1ef6906b5f818b0 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Mon, 2 Feb 2015 00:35:45 -0800 Subject: [PATCH] Add failing test cases for golang issue 5128. --- 101/printer/printer_test.go | 4 +- 101/printer/testdata/comments.golden | 62 ++++++++++++++++++++++++++++ 101/printer/testdata/comments.input | 62 ++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 2 deletions(-) diff --git a/101/printer/printer_test.go b/101/printer/printer_test.go index 3b0570e..21b13a8 100644 --- a/101/printer/printer_test.go +++ b/101/printer/printer_test.go @@ -96,8 +96,8 @@ func diff(aname, bname string, a, b []byte) error { for i := 0; i < len(a) && i < len(b); i++ { ch := a[i] if ch != b[i] { - fmt.Fprintf(&buf, "\n%s:%d:%d: %s", aname, line, i-offs+1, lineAt(a, offs)) - fmt.Fprintf(&buf, "\n%s:%d:%d: %s", bname, line, i-offs+1, lineAt(b, offs)) + fmt.Fprintf(&buf, "\n%s:%d:%d: %q", aname, line, i-offs+1, lineAt(a, offs)) + fmt.Fprintf(&buf, "\n%s:%d:%d: %q", bname, line, i-offs+1, lineAt(b, offs)) fmt.Fprintf(&buf, "\n\n") break } diff --git a/101/printer/testdata/comments.golden b/101/printer/testdata/comments.golden index b1af795..0a97156 100644 --- a/101/printer/testdata/comments.golden +++ b/101/printer/testdata/comments.golden @@ -413,6 +413,68 @@ func _() { aligned line */ } +// Test cases from issue 5128? +func _() { + /*a string + + b string*/ + + /*A string + + + + Z string*/ + + /*a string + + b string + + c string*/ + + { + /*a string + b string*/ + + /*a string + + b string*/ + + /*a string + + b string + + c string*/ + } + + { + /*a string + b string*/ + + /*a string + + b string*/ + + /*a string + + b string + + c string*/ + } + + /* + */ + + /* + + */ + + /* + + * line + + */ +} + /* * line * of diff --git a/101/printer/testdata/comments.input b/101/printer/testdata/comments.input index 983e2b2..51b9a22 100644 --- a/101/printer/testdata/comments.input +++ b/101/printer/testdata/comments.input @@ -418,6 +418,68 @@ func _() { aligned line */ } +// Test cases from issue 5128? +func _() { + /*a string + + b string*/ + + /*A string + + + + Z string*/ + + /*a string + + b string + + c string*/ + + { + /*a string +b string*/ + + /*a string + +b string*/ + + /*a string + +b string + +c string*/ + } + + { + /*a string + b string*/ + + /*a string + + b string*/ + + /*a string + + b string + + c string*/ + } + + /* + */ + + /* + + */ + + /* + + * line + + */ +} + /* * line * of