@@ -4,6 +4,10 @@ import (
44 "testing"
55)
66
7+ const (
8+ urlTestString = "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel.\xff \xff \xff \x3e \xfe \x00 "
9+ )
10+
711func TestURLEncodeString (t * testing.T ) {
812 encoded := URLEncodeString ("foo !~" )
913
@@ -25,7 +29,7 @@ func TestEncodeBase64(t *testing.T) {
2529}
2630
2731func TestEncodeBase64URL (t * testing.T ) {
28- encoded := EncodeBase64URL ("Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel. \xff \xff \xff \x3e \xfe \x00 " )
32+ encoded := EncodeBase64URL (urlTestString )
2933
3034 if encoded != "VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA=" {
3135 t .Fatal (encoded )
@@ -37,7 +41,7 @@ func TestEncodeBase64URL(t *testing.T) {
3741func TestDecodeBase64URL (t * testing.T ) {
3842 decoded := DecodeBase64URL ("VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA=" )
3943
40- if decoded != "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel. \xff \xff \xff \x3e \xfe \x00 " {
44+ if decoded != urlTestString {
4145 t .Fatal (decoded )
4246 }
4347
@@ -47,7 +51,7 @@ func TestDecodeBase64URL(t *testing.T) {
4751func TestDecodeBase64URL_NoPad (t * testing.T ) {
4852 decoded := DecodeBase64URL ("VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA" )
4953
50- if decoded != "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel. \xff \xff \xff \x3e \xfe \x00 " {
54+ if decoded != urlTestString {
5155 t .Fatal (decoded )
5256 }
5357
@@ -57,7 +61,7 @@ func TestDecodeBase64URL_NoPad(t *testing.T) {
5761func TestDecodeBase64URL_WayTooMuchPadding (t * testing.T ) {
5862 decoded := DecodeBase64URL ("VGhlc2t5YWJvdmV0aGVwb3J0d2FzdGhlY29sb3JvZnRlbGV2aXNpb24sdHVuZWR0b2FkZWFkY2hhbm5lbC7___8-_gA=======" )
5963
60- if decoded != "Theskyabovetheportwasthecoloroftelevision,tunedtoadeadchannel. \xff \xff \xff \x3e \xfe \x00 " {
64+ if decoded != urlTestString {
6165 t .Fatal (decoded )
6266 }
6367
0 commit comments