forked from AliyunContainerService/pouch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiskquota_test.go
More file actions
36 lines (34 loc) · 1023 Bytes
/
Copy pathdiskquota_test.go
File metadata and controls
36 lines (34 loc) · 1023 Bytes
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
package opts
import (
"reflect"
"testing"
)
func TestParseDiskQuota(t *testing.T) {
type args struct {
diskquota []string
}
tests := []struct {
name string
args args
want map[string]string
wantErr bool
}{
// TODO: Add test cases.
{name: "test1", args: args{diskquota: []string{""}}, want: nil, wantErr: true},
{name: "test2", args: args{diskquota: []string{"foo=foo=foo"}}, want: nil, wantErr: true},
{name: "test3", args: args{diskquota: []string{"foo"}}, want: map[string]string{"/": "foo"}, wantErr: false},
{name: "test3", args: args{diskquota: []string{"foo=foo"}}, want: map[string]string{"foo": "foo"}, wantErr: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := ParseDiskQuota(tt.args.diskquota)
if (err != nil) != tt.wantErr {
t.Errorf("ParseDiskQuota() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("ParseDiskQuota() = %v, want %v", got, tt.want)
}
})
}
}