File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -566,7 +566,7 @@ func encodeScriptReason(script string) string {
566566 start := 0
567567 line := 1
568568 for i , r := range script {
569- if ! (unicode .IsPrint (r ) || r == '\n' || r == '\r' || r == '\t' ) {
569+ if ! (unicode .IsPrint (r ) || r == '\n' ) {
570570 return fmt .Sprintf ("unprintable character %q at offset %d" , r , i )
571571 }
572572 // maxLineLength includes final newline
Original file line number Diff line number Diff line change @@ -503,6 +503,11 @@ func TestEncodeScriptReason(t *testing.T) {
503503 reason := encodeScriptReason ("abc\a 123" )
504504 assert .Equal (t , reason , "unprintable character '\\ a' at offset 3" )
505505 })
506+ t .Run ("contains a tab character" , func (t * testing.T ) {
507+ // newline character is included in character count
508+ reason := encodeScriptReason ("foo\t bar" )
509+ assert .Equal (t , reason , "unprintable character '\\ t' at offset 3" )
510+ })
506511 t .Run ("long line" , func (t * testing.T ) {
507512 // newline character is included in character count
508513 reason := encodeScriptReason ("line 1\n line 2\n 01234567\n " )
You can’t perform that action at this time.
0 commit comments