From 517787cb34176fd7eda5466627d04dedbba694cc Mon Sep 17 00:00:00 2001 From: Tomasz Janiszewski Date: Tue, 16 Aug 2022 11:50:56 +0200 Subject: [PATCH] Revert "Drop control characters from output" This reverts commit bc70670a401d5123cafab4aa5fbc988e6bf742f6. --- parser/gotest/internal/collector/collector.go | 17 +++-------------- testdata/035-report.xml | 12 ++---------- testdata/035-whitespace.txt | Bin 2470 -> 2224 bytes testdata/src/whitespace/whitespace_test.go | 6 ------ 4 files changed, 5 insertions(+), 30 deletions(-) diff --git a/parser/gotest/internal/collector/collector.go b/parser/gotest/internal/collector/collector.go index 1d856084..92d5e1ff 100644 --- a/parser/gotest/internal/collector/collector.go +++ b/parser/gotest/internal/collector/collector.go @@ -4,24 +4,13 @@ package collector import ( "sort" - "strings" "time" - "unicode" ) // line is a single line of output captured at some point in time. type line struct { Timestamp time.Time - text string -} - -func (l line) SafeText() string { - return strings.Map(func(r rune) rune { - if unicode.IsControl(r) && !unicode.IsSpace(r) { - return -1 - } - return r - }, l.text) + Text string } // Output stores output lines grouped by id. Output can be retrieved for one or @@ -65,7 +54,7 @@ func (o *Output) Contains(id int) bool { func (o *Output) Get(id int) []string { var lines []string for _, line := range o.m[id] { - lines = append(lines, line.SafeText()) + lines = append(lines, line.Text) } return lines } @@ -82,7 +71,7 @@ func (o *Output) GetAll(ids ...int) []string { }) var lines []string for _, line := range output { - lines = append(lines, line.SafeText()) + lines = append(lines, line.Text) } return lines } diff --git a/testdata/035-report.xml b/testdata/035-report.xml index 70b972c5..db1a68cc 100644 --- a/testdata/035-report.xml +++ b/testdata/035-report.xml @@ -1,6 +1,6 @@ - - + + @@ -45,10 +45,6 @@ one-newline two-newlines two-newlines two-newlines]]> - - - @@ -93,9 +89,5 @@ two-newlines two-newlines two-newlines]]> - - - diff --git a/testdata/035-whitespace.txt b/testdata/035-whitespace.txt index 544a4041dfaaca3c810925bfca270d0550046c7e..7d6590ca4d88e751e4be187624dae8c52f9378fe 100644 GIT binary patch delta 28 kcmZ1`yg_ioU*^dTEF7B)S(Y$QKEcd4xsK!N