File tree Expand file tree Collapse file tree 5 files changed +5
-39
lines changed
parser/gotest/internal/collector Expand file tree Collapse file tree 5 files changed +5
-39
lines changed Original file line number Diff line number Diff line change @@ -4,24 +4,13 @@ package collector
4
4
5
5
import (
6
6
"sort"
7
- "strings"
8
7
"time"
9
- "unicode"
10
8
)
11
9
12
10
// line is a single line of output captured at some point in time.
13
11
type line struct {
14
12
Timestamp time.Time
15
- text string
16
- }
17
-
18
- func (l line ) SafeText () string {
19
- return strings .Map (func (r rune ) rune {
20
- if unicode .IsControl (r ) && ! unicode .IsSpace (r ) {
21
- return - 1
22
- }
23
- return r
24
- }, l .text )
13
+ Text string
25
14
}
26
15
27
16
// Output stores output lines grouped by id. Output can be retrieved for one or
@@ -55,7 +44,7 @@ func (o *Output) Contains(id int) bool {
55
44
func (o * Output ) Get (id int ) []string {
56
45
var lines []string
57
46
for _ , line := range o .m [id ] {
58
- lines = append (lines , line .SafeText () )
47
+ lines = append (lines , line .Text )
59
48
}
60
49
return lines
61
50
}
@@ -72,7 +61,7 @@ func (o *Output) GetAll(ids ...int) []string {
72
61
})
73
62
var lines []string
74
63
for _ , line := range output {
75
- lines = append (lines , line .SafeText () )
64
+ lines = append (lines , line .Text )
76
65
}
77
66
return lines
78
67
}
Original file line number Diff line number Diff line change @@ -89,12 +89,3 @@ func TestMerge(t *testing.T) {
89
89
t .Errorf ("Get(2) after Merge(2, 1) incorrect (-want +got):\n %s" , diff )
90
90
}
91
91
}
92
-
93
- func TestSafeText (t * testing.T ) {
94
- l := line {text : "\t x\x00 y\x1b z\n " }
95
- got := l .SafeText ()
96
- want := "\t xyz\n "
97
- if diff := cmp .Diff (want , got ); diff != "" {
98
- t .Errorf ("SafeText() for %q incorrect (-want +got):\n %s" , l .text , diff )
99
- }
100
- }
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <testsuites tests =" 11 " >
3
- <testsuite name =" package/whitespace" tests =" 11 " failures =" 0" errors =" 0" id =" 0" hostname =" hostname" time =" 0.001" timestamp =" 2022-01-01T00:00:00Z" >
2
+ <testsuites tests =" 9 " >
3
+ <testsuite name =" package/whitespace" tests =" 9 " failures =" 0" errors =" 0" id =" 0" hostname =" hostname" time =" 0.001" timestamp =" 2022-01-01T00:00:00Z" >
4
4
<properties >
5
5
<property name =" go.version" value =" 1.0" ></property >
6
6
</properties >
@@ -45,10 +45,6 @@ one-newline
45
45
two-newlines
46
46
two-newlines
47
47
two-newlines]]> </system-out >
48
- </testcase >
49
- <testcase name =" TestControl" classname =" package/whitespace" time =" 0.000" >
50
- <system-out ><![CDATA[ whitespace_test.go:49: log control
51
- printf control]]> </system-out >
52
48
</testcase >
53
49
<testcase name =" TestSubTests" classname =" package/whitespace" time =" 0.000" ></testcase >
54
50
<testcase name =" TestSubTests/TestFlat" classname =" package/whitespace" time =" 0.000" >
@@ -93,9 +89,5 @@ two-newlines
93
89
two-newlines
94
90
two-newlines]]> </system-out >
95
91
</testcase >
96
- <testcase name =" TestSubTests/TestControl" classname =" package/whitespace" time =" 0.000" >
97
- <system-out ><![CDATA[ whitespace_test.go:49: log control
98
- printf control]]> </system-out >
99
- </testcase >
100
92
</testsuite >
101
93
</testsuites >
Original file line number Diff line number Diff line change @@ -45,15 +45,9 @@ func TestWithNewlinesFlat(t *testing.T) {
45
45
fmt .Println ("two-newlines\n two-newlines\n two-newlines" )
46
46
}
47
47
48
- func TestControl (t * testing.T ) {
49
- t .Logf ("log\x00 control" )
50
- fmt .Printf ("printf\x00 control\n " )
51
- }
52
-
53
48
func TestSubTests (t * testing.T ) {
54
49
t .Run ("TestFlat" , TestFlat )
55
50
t .Run ("TestWithSpace" , TestWithSpace )
56
51
t .Run ("TestWithTab" , TestWithTab )
57
52
t .Run ("TestWithNewlinesFlat" , TestWithNewlinesFlat )
58
- t .Run ("TestControl" , TestControl )
59
53
}
You can’t perform that action at this time.
0 commit comments