diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-05 02:42:41 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-05 02:52:50 +0900 |
| commit | eb5ee4fece0327b1183ae823d68e4cf4e3e1ced0 (patch) | |
| tree | 64e1c411e9d0a29637982519b9bd3a5ff6642d1a /internal/app/app_stub_test.go | |
| parent | 9462af08f38fefe40d985383d8825258a6d1f0a8 (diff) | |
internal/app: modularise outcome finalise
This is the initial effort of splitting up host and container side of finalisation for params to shim. The new layout also enables much finer grained unit testing of each step, as well as partition access to per-app state for each step.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/app_stub_test.go')
| -rw-r--r-- | internal/app/app_stub_test.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/app/app_stub_test.go b/internal/app/app_stub_test.go index 8d33cd15..fc0030b4 100644 --- a/internal/app/app_stub_test.go +++ b/internal/app/app_stub_test.go @@ -1,7 +1,9 @@ package app import ( + "bytes" "fmt" + "io" "io/fs" "log" "os/exec" @@ -52,12 +54,21 @@ func (k *stubNixOS) stat(name string) (fs.FileInfo, error) { case "/home/ophestra/.pulse-cookie": return stubFileInfoIsDir(true), nil case "/home/ophestra/xdg/config/pulse/cookie": - return stubFileInfoIsDir(false), nil + return stubFileInfoPulseCookie{false}, nil default: panic(fmt.Sprintf("attempted to stat unexpected path %q", name)) } } +func (k *stubNixOS) open(name string) (osFile, error) { + switch name { + case "/home/ophestra/xdg/config/pulse/cookie": + return stubOsFileReadCloser{io.NopCloser(bytes.NewReader(bytes.Repeat([]byte{0}, pulseCookieSizeMax)))}, nil + default: + panic(fmt.Sprintf("attempted to open unexpected path %q", name)) + } +} + func (k *stubNixOS) readdir(name string) ([]fs.DirEntry, error) { switch name { case "/": |
