File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 2
2
package zltest
3
3
4
4
import (
5
- "bufio"
6
5
"bytes"
7
6
"encoding/json"
8
7
"sync"
@@ -61,24 +60,26 @@ func (tst *Tester) Entries() Entries {
61
60
defer tst .mx .RUnlock ()
62
61
tst .t .Helper ()
63
62
64
- scn := bufio .NewScanner (bytes .NewReader (tst .buf ))
65
63
ets := make ([]* Entry , 0 , tst .cnt )
66
- for scn .Scan () {
64
+
65
+ var off int64
66
+ dec := json .NewDecoder (bytes .NewReader (tst .buf ))
67
+ for dec .More () {
67
68
m := make (map [string ]interface {})
68
- if err := json . Unmarshal ( scn . Bytes (), & m ); err != nil {
69
+ if err := dec . Decode ( & m ); err != nil {
69
70
tst .t .Fatal (err )
71
+ return Entries {t : tst .t }
70
72
}
73
+
74
+ tmp := tst .buf [off :dec .InputOffset ()]
75
+ off = dec .InputOffset ()
71
76
ets = append (ets , & Entry {
72
- raw : scn . Text ( ),
77
+ raw : string ( bytes . TrimSpace ( tmp ) ),
73
78
m : m ,
74
79
t : tst .t ,
75
80
})
76
81
}
77
82
78
- if err := scn .Err (); err != nil {
79
- tst .t .Fatal (err )
80
- }
81
-
82
83
return Entries {e : ets , t : tst .t }
83
84
}
84
85
You can’t perform that action at this time.
0 commit comments