mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fix Emoji benchmark
The Emoji implementations gives slightly different output. One of them pads with a space.
This commit is contained in:
parent
aa66478c20
commit
6c0f705217
1 changed files with 5 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
||||||
package helpers
|
package helpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -129,7 +130,10 @@ func doBenchmarkEmoji(b *testing.B, f func(in []byte) []byte) {
|
||||||
currIn := in[cnt]
|
currIn := in[cnt]
|
||||||
cnt++
|
cnt++
|
||||||
result := f(currIn.in)
|
result := f(currIn.in)
|
||||||
if len(result) != len(currIn.expect) {
|
// The Emoji implementations gives slightly different output.
|
||||||
|
diffLen := len(result) - len(currIn.expect)
|
||||||
|
diffLen = int(math.Abs(float64(diffLen)))
|
||||||
|
if diffLen > 30 {
|
||||||
b.Fatalf("[%d] emoji std, got \n%q but expected \n%q", j, result, currIn.expect)
|
b.Fatalf("[%d] emoji std, got \n%q but expected \n%q", j, result, currIn.expect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue