aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ryan <mark.d.ryan@intel.com>2017-06-23 14:13:11 +0100
committerBrad Fitzpatrick <bradfitz@golang.org>2017-06-23 14:28:30 +0000
commit856fd8f50e0ccc7b43a0d4846f4c3de9f53a4e9a (patch)
tree57916a2c2646bb288ff0a294f3247b1c640a3130
parent43ae54ba2a4583fbdbf8a7641bf584ab5f8153b1 (diff)
downloadgo-856fd8f50e0ccc7b43a0d4846f4c3de9f53a4e9a.tar.gz
go-856fd8f50e0ccc7b43a0d4846f4c3de9f53a4e9a.zip
encoding/ascii85: make bigtest big again
ascii85_test.go contains a variable called bigtest that is used as test data for TestDecoderBuffering and TestEncoderBuffering. The variable is initialised to a copy of the last element of the pairs slice. When the variable was first added the last element of this slice contained a sizable test case, 342 encoded characters. However, https://golang.org/cl/5970078 added a new element to the end of the pairs slice without updating bigtest. As the new element contained only 1 byte of encoded data bigtest became very small test. This commit fixes the problem by resetting bigtest to its original value and making its initialisation independent of the layout of pairs. All the unit tests still pass. Change-Id: If7fb609ced9da93a2321dfd8372986b2fa772fd5 Reviewed-on: https://go-review.googlesource.com/46475 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--src/encoding/ascii85/ascii85_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/encoding/ascii85/ascii85_test.go b/src/encoding/ascii85/ascii85_test.go
index b8be960863..1a3a87a596 100644
--- a/src/encoding/ascii85/ascii85_test.go
+++ b/src/encoding/ascii85/ascii85_test.go
@@ -16,6 +16,18 @@ type testpair struct {
decoded, encoded string
}
+var bigtest = testpair{
+ "Man is distinguished, not only by his reason, but by this singular passion from " +
+ "other animals, which is a lust of the mind, that by a perseverance of delight in " +
+ "the continued and indefatigable generation of knowledge, exceeds the short " +
+ "vehemence of any carnal pleasure.",
+ "9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>Cj@.4Gp$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,\n" +
+ "O<DJ+*.@<*K0@<6L(Df-\\0Ec5e;DffZ(EZee.Bl.9pF\"AGXBPCsi+DGm>@3BB/F*&OCAfu2/AKY\n" +
+ "i(DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIa\n" +
+ "l(DId<j@<?3r@:F%a+D58'ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G\n" +
+ ">uD.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c\n",
+}
+
var pairs = []testpair{
// Encode returns 0 when len(src) is 0
{
@@ -23,17 +35,7 @@ var pairs = []testpair{
"",
},
// Wikipedia example
- {
- "Man is distinguished, not only by his reason, but by this singular passion from " +
- "other animals, which is a lust of the mind, that by a perseverance of delight in " +
- "the continued and indefatigable generation of knowledge, exceeds the short " +
- "vehemence of any carnal pleasure.",
- "9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKF<GL>Cj@.4Gp$d7F!,L7@<6@)/0JDEF<G%<+EV:2F!,\n" +
- "O<DJ+*.@<*K0@<6L(Df-\\0Ec5e;DffZ(EZee.Bl.9pF\"AGXBPCsi+DGm>@3BB/F*&OCAfu2/AKY\n" +
- "i(DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF<G:8+EV:.+Cf>-FD5W8ARlolDIa\n" +
- "l(DId<j@<?3r@:F%a+D58'ATD4$Bl@l3De:,-DJs`8ARoFb/0JMK@qB4^F!,R<AKZ&-DfTqBG%G\n" +
- ">uD.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c\n",
- },
+ bigtest,
// Special case when shortening !!!!! to z.
{
"\000\000\000\000",
@@ -41,8 +43,6 @@ var pairs = []testpair{
},
}
-var bigtest = pairs[len(pairs)-1]
-
func testEqual(t *testing.T, msg string, args ...interface{}) bool {
t.Helper()
if args[len(args)-2] != args[len(args)-1] {