aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/initmkdir_test.go
blob: ad326240e0c49eb04cf2deb03d7501fc26847fb1 (plain)
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
package container

import "testing"

func TestMkdirOp(t *testing.T) {
	checkOpsValid(t, []opValidTestCase{
		{"nil", (*MkdirOp)(nil), false},
		{"zero", new(MkdirOp), false},
		{"valid", &MkdirOp{Path: MustAbs("/.hakurei")}, true},
	})

	checkOpsBuilder(t, []opsBuilderTestCase{
		{"etc", new(Ops).Mkdir(MustAbs("/etc/"), 0), Ops{
			&MkdirOp{Path: MustAbs("/etc/")},
		}},
	})

	checkOpIs(t, []opIsTestCase{
		{"zero", new(MkdirOp), new(MkdirOp), false},
		{"path differs", &MkdirOp{Path: MustAbs("/"), Perm: 0755}, &MkdirOp{Path: MustAbs("/etc/"), Perm: 0755}, false},
		{"perm differs", &MkdirOp{Path: MustAbs("/")}, &MkdirOp{Path: MustAbs("/"), Perm: 0755}, false},
		{"equals", &MkdirOp{Path: MustAbs("/")}, &MkdirOp{Path: MustAbs("/")}, true},
	})

	checkOpMeta(t, []opMetaTestCase{
		{"etc", &MkdirOp{
			Path: MustAbs("/etc/"),
		}, "creating", `directory "/etc/" perm ----------`},
	})
}