github.com/sohaha/zlsgo@v1.7.13-0.20240501141223-10dd1a906f76/zstring/url_test.go (about)

     1  package zstring
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/sohaha/zlsgo"
     7  )
     8  
     9  func TestUrl(t *testing.T) {
    10  	tt := zlsgo.NewTest(t)
    11  	str := "?d=1 &c=2"
    12  	res := UrlEncode(str)
    13  	t.Log(res)
    14  	d, err := UrlDecode(str)
    15  	tt.EqualNil(err)
    16  	tt.Equal(str, d)
    17  
    18  	res = UrlRawEncode(str)
    19  	t.Log(res)
    20  	d, err = UrlRawDecode(str)
    21  	tt.EqualNil(err)
    22  	tt.Equal(str, d)
    23  }