Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
testing: multiline example output comparison doesn't strip per-line whitespace #6416
What steps will reproduce the problem? 1. Write a testing example that generates multiline output and in which interior lines have trailing whitespace. For example, http://play.golang.org/p/3t5VyhWw7Z or http://play.golang.org/p/nwSaMHGKU3. 2. go test What is the expected output? Interior lines' leading and trailing whitespace is stripped. The examples I provided should pass. What do you see instead? Whitespace is stripped from the beginning of the first and the end of the last line only. The examples I provided fail. Which version are you using? (run 'go version') Reproduced with 1.1 and devel +5981425e55ce Tue Sep 17 16:54:22 2013 -0400 darwin/amd64 Please provide any additional information below. The documentation doesn't strictly imply this behavior -- it says "(The comparison ignores leading and trailing space.)". However, the fact that gofmt strips trailing whitespace makes it hard to write certain examples (e.g. those involving raw HTTP requests/responses) without this behavior.
referenced this issue
Dec 8, 2014
I urge you to reopen this bug. As far as I can figure, there is no way to test output that has trailing whitespace in intermediate lines. At least I can't find an easy work around.
The examples at the top of the issue still don't work and can't, as far as I can figure, be made to work. I also can't make /* */ syntax work: http://play.golang.org/p/51D2DYVHTy