travis-ci
69 of 69 new or added lines in 4 files covered. (100.0%)
3072 of 4035 relevant lines covered (76.13%)
15.08 hits per line
1 |
package zendesk
|
|
2 |
|
|
3 |
import (
|
|
4 |
"strings"
|
|
5 |
) |
|
6 |
|
|
7 |
type includeBuilder struct { |
|
8 |
keys []string
|
|
9 |
} |
|
10 |
|
|
|
func (b *includeBuilder) addKey(s string) *includeBuilder { |
16✔ |
|
b.keys = append(b.keys, s)
|
16✔ |
|
return b
|
16✔ |
|
} |
16✔ |
15 |
|
|
|
func (b *includeBuilder) toInterface() (interface{}, error) { |
16✔ |
|
var csl strings.Builder
|
16✔ |
|
|
16✔ |
|
for i, key := range b.keys { |
32✔ |
|
_, err := csl.WriteString(key) |
16✔ |
|
if err != nil { |
16✔ |
|
return nil, err |
× |
|
} |
× |
24 |
|
|
|
if i < len(b.keys)-1 { |
24✔ |
|
_, err := csl.WriteString(",")
|
8✔ |
|
if err != nil { |
8✔ |
|
return nil, err |
× |
|
} |
× |
30 |
} |
|
31 |
} |
|
32 |
|
|
|
var data struct { |
16✔ |
|
Include string `url:"include"` |
16✔ |
|
} |
16✔ |
|
|
16✔ |
|
data.Include = csl.String() |
16✔ |
|
|
16✔ |
|
return data, nil |
16✔ |
40 |
} |
|
41 |
|
|
|
func (b *includeBuilder) path(basePath string) (string, error) { |
16✔ |
|
opts, err := b.toInterface() |
16✔ |
|
if err != nil { |
16✔ |
|
return "", err |
× |
|
} |
× |
47 |
|
|
|
return addOptions(basePath, opts)
|
16✔ |
49 |
} |