diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-17 19:00:43 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-17 19:00:43 +0900 |
| commit | 90cb01b2748550228d0bc179691a19ebb996fc36 (patch) | |
| tree | 06a2e17b578312c3f0734bf4c476e3c2eb5f6908 /internal/system/mkdir_test.go | |
| parent | b1e1d5627e6532ec719c761846d7f38fe93fcadd (diff) | |
system: move out of internal
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/system/mkdir_test.go')
| -rw-r--r-- | internal/system/mkdir_test.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/internal/system/mkdir_test.go b/internal/system/mkdir_test.go deleted file mode 100644 index 20826940..00000000 --- a/internal/system/mkdir_test.go +++ /dev/null @@ -1,73 +0,0 @@ -package system - -import ( - "os" - "testing" -) - -func TestEnsure(t *testing.T) { - testCases := []struct { - name string - perm os.FileMode - }{ - {"/tmp/fortify.1971", 0701}, - {"/tmp/fortify.1971/tmpdir", 0700}, - {"/tmp/fortify.1971/tmpdir/150", 0700}, - {"/run/user/1971/fortify", 0700}, - } - for _, tc := range testCases { - t.Run(tc.name+"_"+tc.perm.String(), func(t *testing.T) { - sys := New(150) - sys.Ensure(tc.name, tc.perm) - (&tcOp{User, tc.name}).test(t, sys.ops, []Op{&Mkdir{User, tc.name, tc.perm, false}}, "Ensure") - }) - } -} - -func TestEphemeral(t *testing.T) { - testCases := []struct { - perm os.FileMode - tcOp - }{ - {0700, tcOp{Process, "/run/user/1971/fortify/ec07546a772a07cde87389afc84ffd13"}}, - {0701, tcOp{Process, "/tmp/fortify.1971/ec07546a772a07cde87389afc84ffd13"}}, - } - for _, tc := range testCases { - t.Run(tc.path+"_"+tc.perm.String()+"_"+TypeString(tc.et), func(t *testing.T) { - sys := New(150) - sys.Ephemeral(tc.et, tc.path, tc.perm) - tc.test(t, sys.ops, []Op{&Mkdir{tc.et, tc.path, tc.perm, true}}, "Ephemeral") - }) - } -} - -func TestMkdir_String(t *testing.T) { - testCases := []struct { - want string - ephemeral bool - et Enablement - }{ - {"Ensure", false, User}, - {"Ensure", false, Process}, - {"Ensure", false, EWayland}, - - {"Wayland", true, EWayland}, - {"X11", true, EX11}, - {"D-Bus", true, EDBus}, - {"PulseAudio", true, EPulse}, - } - for _, tc := range testCases { - t.Run(tc.want, func(t *testing.T) { - m := &Mkdir{ - et: tc.et, - path: "/nonexistent", - perm: 0701, - ephemeral: tc.ephemeral, - } - want := "mode: " + os.FileMode(0701).String() + " type: " + tc.want + " path: \"/nonexistent\"" - if got := m.String(); got != want { - t.Errorf("String() = %v, want %v", got, want) - } - }) - } -} |
