mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
28 lines
577 B
Go
28 lines
577 B
Go
package oauth1
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestPercentEncode(t *testing.T) {
|
|
cases := []struct {
|
|
input string
|
|
expected string
|
|
}{
|
|
{" ", "%20"},
|
|
{"%", "%25"},
|
|
{"&", "%26"},
|
|
{"-._", "-._"},
|
|
{" /=+", "%20%2F%3D%2B"},
|
|
{"Ladies + Gentlemen", "Ladies%20%2B%20Gentlemen"},
|
|
{"An encoded string!", "An%20encoded%20string%21"},
|
|
{"Dogs, Cats & Mice", "Dogs%2C%20Cats%20%26%20Mice"},
|
|
{"☃", "%E2%98%83"},
|
|
}
|
|
for _, c := range cases {
|
|
if output := PercentEncode(c.input); output != c.expected {
|
|
t.Errorf("expected %s, got %s", c.expected, output)
|
|
}
|
|
}
|
|
}
|