From: Bjørn Erik Pedersen Date: Fri, 1 Jul 2016 15:59:39 +0000 (+0200) Subject: Fix Emoji benchmark X-Git-Tag: v0.17~260 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6c0f705217b65c7e91fe22c5b8ca0c3f8b1bf33a;p=brevno-suite%2Fhugo Fix Emoji benchmark The Emoji implementations gives slightly different output. One of them pads with a space. --- diff --git a/helpers/emoji_test.go b/helpers/emoji_test.go index c310e6d2..70c54cd5 100644 --- a/helpers/emoji_test.go +++ b/helpers/emoji_test.go @@ -13,6 +13,7 @@ package helpers import ( + "math" "reflect" "strings" "testing" @@ -129,7 +130,10 @@ func doBenchmarkEmoji(b *testing.B, f func(in []byte) []byte) { currIn := in[cnt] cnt++ 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) } }