diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-01-25 15:00:06 +0100 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-01-25 09:00:06 -0500 |
commit | 8ed665cb76c0763e83a2949c4bdd70153baf72f7 (patch) | |
tree | f95023fe251717ea878b5e6f1d4ccffc2e49b2c1 /utils | |
parent | a930eef71dc398fff8ce1a7fdffec8522b9c34f9 (diff) | |
download | chat-8ed665cb76c0763e83a2949c4bdd70153baf72f7.tar.gz chat-8ed665cb76c0763e83a2949c4bdd70153baf72f7.tar.bz2 chat-8ed665cb76c0763e83a2949c4bdd70153baf72f7.zip |
Add initial tests for urlencoded (#5178)
Diffstat (limited to 'utils')
-rw-r--r-- | utils/urlencode_test.go | 35 |
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") + } +} |