forked from tufanbarisyildirim/gonginx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocation_test.go
47 lines (45 loc) · 932 Bytes
/
location_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
package gonginx
import (
"testing"
)
func TestLocation_ToString(t *testing.T) {
t.Parallel()
type fields struct {
Directive *Directive
Modifier string
Match string
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "empty bloc and one match location empty block",
fields: fields{
Directive: &Directive{
Name: "location",
Parameters: []string{"/admin"},
Block: &Block{
Directives: make([]IDirective, 0),
},
},
Modifier: "",
Match: "/admin",
},
want: "location /admin {\n\n}",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
l := &Location{
Directive: tt.fields.Directive,
Modifier: tt.fields.Modifier,
Match: tt.fields.Match,
}
if got := DumpDirective(l, NoIndentStyle); got != tt.want {
t.Errorf("Location.ToString() = %v, want %v", got, tt.want)
}
})
}
}