github.com/pafomin-at-avito/mattermost-server@v5.11.1+incompatible/utils/urlencode_test.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package utils
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  func TestUrlEncode(t *testing.T) {
    11  
    12  	toEncode := "testing 1 2 3"
    13  	encoded := UrlEncode(toEncode)
    14  
    15  	if encoded != "testing%201%202%203" {
    16  		t.Log(encoded)
    17  		t.Fatal("should be equal")
    18  	}
    19  
    20  	toEncode = "testing123"
    21  	encoded = UrlEncode(toEncode)
    22  
    23  	if encoded != "testing123" {
    24  		t.Log(encoded)
    25  		t.Fatal("should be equal")
    26  	}
    27  
    28  	toEncode = "testing$#~123"
    29  	encoded = UrlEncode(toEncode)
    30  
    31  	if encoded != "testing%24%23~123" {
    32  		t.Log(encoded)
    33  		t.Fatal("should be equal")
    34  	}
    35  }