func TestQueryParams_String_EmptyParams(t *testing.T) { params := issues.QueryParams{} if expected, actual := "", params.String(); expected != actual { t.Errorf("actual: %s", actual) t.Errorf("expected: %s", expected) } }
func TestQueryParams_String_AnyParams(t *testing.T) { params := issues.QueryParams{ "a": "123", "b": "bool", "c": "def", } data := make([]string, 0, len(params)) for k, v := range params { data = append(data, fmt.Sprintf("%s=%s", k, v)) } sort.Strings(data) p := strings.Split(params.String(), "&") sort.Strings(p) if expected, actual := strings.Join(data, "&"), strings.Join(p, "&"); expected != actual { t.Errorf("actual: %s", actual) t.Errorf("expected: %s", expected) } }