ref: 6c0f705217b65c7e91fe22c5b8ca0c3f8b1bf33a
parent: aa66478c201053165e5f7dd041915f68f7f87c27
author: Bjørn Erik Pedersen <[email protected]>
date: Fri Jul 1 13:59:39 EDT 2016
Fix Emoji benchmark The Emoji implementations gives slightly different output. One of them pads with a space.
--- 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 @@
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)
}
}