-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy patharguments_test.go
54 lines (50 loc) · 1.22 KB
/
arguments_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
package main
import (
"github.com/elliotchance/testify-stats/assert"
"testing"
)
var argumentTests = map[string]struct {
Arguments Arguments
Names []string
GoArguments []string
}{
"Nil": {
Arguments: nil,
Names: nil,
GoArguments: nil,
},
"Empty": {
Arguments: map[string]Type{},
Names: nil,
GoArguments: nil,
},
"One": {
Arguments: map[string]Type{"foo": "int"},
Names: []string{"foo"},
GoArguments: []string{"foo int"},
},
"ArgumentsAlwaysSortedByName": {
Arguments: map[string]Type{"foo": "int", "bar": "*float64"},
Names: []string{"bar", "foo"},
GoArguments: []string{"bar *float64", "foo int"},
},
"RemovePackageName": {
Arguments: map[string]Type{"req": "*net/http.Request"},
Names: []string{"req"},
GoArguments: []string{"req *http.Request"},
},
}
func TestArguments_Names(t *testing.T) {
for testName, test := range argumentTests {
t.Run(testName, func(t *testing.T) {
assert.Equal(t, test.Names, test.Arguments.Names())
})
}
}
func TestArguments_GoArguments(t *testing.T) {
for testName, test := range argumentTests {
t.Run(testName, func(t *testing.T) {
assert.Equal(t, test.GoArguments, test.Arguments.GoArguments())
})
}
}