summaryrefslogtreecommitdiffstats
path: root/utils/urlencode_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/urlencode_test.go')
-rw-r--r--utils/urlencode_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/utils/urlencode_test.go b/utils/urlencode_test.go
new file mode 100644
index 000000000..04d69fd98
--- /dev/null
+++ b/utils/urlencode_test.go
@@ -0,0 +1,35 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package utils
+
+import (
+ "testing"
+)
+
+func TestUrlEncode(t *testing.T) {
+
+ toEncode := "testing 1 2 3"
+ encoded := UrlEncode(toEncode)
+
+ if encoded != "testing%201%202%203" {
+ t.Log(encoded)
+ t.Fatal("should be equal")
+ }
+
+ toEncode = "testing123"
+ encoded = UrlEncode(toEncode)
+
+ if encoded != "testing123" {
+ t.Log(encoded)
+ t.Fatal("should be equal")
+ }
+
+ toEncode = "testing$#~123"
+ encoded = UrlEncode(toEncode)
+
+ if encoded != "testing%24%23~123" {
+ t.Log(encoded)
+ t.Fatal("should be equal")
+ }
+}