Commit 1b57c3e4 authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Kamil Kisiel

tests: Fix BenchmarkEncode

After 6e5e403e (encoder: Fix GLOBAL emission wrt module/name with \n)
BenchmarkEncode started to fail with

    --- FAIL: BenchmarkEncode
        ogorek_test.go:1003: protocol 0-3: global: module & name must be string without \n

-> Fix it by taking as input only those testdata objects that are marked
to encode without errors.
parent 6ce3a6ee
...@@ -1000,9 +1000,11 @@ func BenchmarkEncode(b *testing.B) { ...@@ -1000,9 +1000,11 @@ func BenchmarkEncode(b *testing.B) {
input := make([]interface{}, 0) input := make([]interface{}, 0)
approxOutSize := 0 approxOutSize := 0
for _, test := range tests { for _, test := range tests {
if test.picklev[0].err == nil {
input = append(input, test.objectIn) input = append(input, test.objectIn)
approxOutSize += len(test.picklev[0].data) approxOutSize += len(test.picklev[0].data)
} }
}
buf := bytes.NewBuffer(make([]byte, approxOutSize)) buf := bytes.NewBuffer(make([]byte, approxOutSize))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment