forked from grafana/k6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions_test.go
65 lines (61 loc) · 822 Bytes
/
options_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package cmd
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseTagKeyValue(t *testing.T) {
t.Parallel()
testData := []struct {
input string
name string
value string
err error
}{
{
"",
"",
"",
errTagEmptyString,
},
{
"=",
"",
"",
errTagEmptyName,
},
{
"=test",
"",
"",
errTagEmptyName,
},
{
"test",
"",
"",
errTagEmptyValue,
},
{
"test=",
"",
"",
errTagEmptyValue,
},
{
"myTag=foo",
"myTag",
"foo",
nil,
},
}
for _, data := range testData {
data := data
t.Run(data.input, func(t *testing.T) {
t.Parallel()
name, value, err := parseTagNameValue(data.input)
assert.Equal(t, name, data.name)
assert.Equal(t, value, data.value)
assert.Equal(t, err, data.err)
})
}
}