From 51e84ba8a52bcd06f544ace45f3fecb9396881ab Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sun, 27 Oct 2024 11:56:20 +0900 Subject: system/dbus: compare sealed value by string Stringer method of dbus.Proxy returns a string representation of its args stream when sealed. Signed-off-by: Ophestra Umiker --- internal/app/app_test.go | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'internal/app/app_test.go') diff --git a/internal/app/app_test.go b/internal/app/app_test.go index 2d7958b6..fd223afb 100644 --- a/internal/app/app_test.go +++ b/internal/app/app_test.go @@ -4,6 +4,7 @@ import ( "io/fs" "reflect" "testing" + "time" "git.ophivana.moe/security/fortify/helper/bwrap" "git.ophivana.moe/security/fortify/internal" @@ -79,3 +80,55 @@ func (p stubDirEntryPath) Type() fs.FileMode { func (p stubDirEntryPath) Info() (fs.FileInfo, error) { panic("attempted to call Info") } + +type stubFileInfoMode fs.FileMode + +func (s stubFileInfoMode) Name() string { + panic("attempted to call Name") +} + +func (s stubFileInfoMode) Size() int64 { + panic("attempted to call Size") +} + +func (s stubFileInfoMode) Mode() fs.FileMode { + return fs.FileMode(s) +} + +func (s stubFileInfoMode) ModTime() time.Time { + panic("attempted to call ModTime") +} + +func (s stubFileInfoMode) IsDir() bool { + panic("attempted to call IsDir") +} + +func (s stubFileInfoMode) Sys() any { + panic("attempted to call Sys") +} + +type stubFileInfoIsDir bool + +func (s stubFileInfoIsDir) Name() string { + panic("attempted to call Name") +} + +func (s stubFileInfoIsDir) Size() int64 { + panic("attempted to call Size") +} + +func (s stubFileInfoIsDir) Mode() fs.FileMode { + panic("attempted to call Mode") +} + +func (s stubFileInfoIsDir) ModTime() time.Time { + panic("attempted to call ModTime") +} + +func (s stubFileInfoIsDir) IsDir() bool { + return bool(s) +} + +func (s stubFileInfoIsDir) Sys() any { + panic("attempted to call Sys") +} -- cgit v1.3.1