Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-01 18:59:39 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-07-01 18:59:39 +0300
commit6c0f705217b65c7e91fe22c5b8ca0c3f8b1bf33a (patch)
tree96fc1cf2f663e1fe278fd2a3d17363340e8dc652 /helpers
parentaa66478c201053165e5f7dd041915f68f7f87c27 (diff)
Fix Emoji benchmark
The Emoji implementations gives slightly different output. One of them pads with a space.
Diffstat (limited to 'helpers')
-rw-r--r--helpers/emoji_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/helpers/emoji_test.go b/helpers/emoji_test.go
index c310e6d28..70c54cd55 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)
}
}