aboutsummaryrefslogtreecommitdiffhomepage
path: root/system/xhost_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-13 01:15:19 +0900
committerOphestra <cat@gensokyo.uk>2025-11-13 01:17:47 +0900
commit4e7aab07d5b175345fdf3ea08868dab1e6d90126 (patch)
treea625cca0e8cdf576313fe2d9ab07a22d1839ee7c /system/xhost_test.go
parent15a66a2b314e7a674c9445e25ffb2451ec73b55e (diff)
internal/system: relocate from system
These packages are highly specific to hakurei and are difficult to use safely from other pieces of code. Their exported symbols are made available until v0.4.0 where they will be removed for #24. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/xhost_test.go')
-rw-r--r--system/xhost_test.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/system/xhost_test.go b/system/xhost_test.go
deleted file mode 100644
index 759f7536..00000000
--- a/system/xhost_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package system
-
-import (
- "testing"
-
- "hakurei.app/container/stub"
- "hakurei.app/hst"
- "hakurei.app/system/internal/xcb"
-)
-
-func TestXHostOp(t *testing.T) {
- t.Parallel()
-
- checkOpBehaviour(t, []opBehaviourTestCase{
- {"xcbChangeHosts revert", 0xbeef, hst.EX11, xhostOp("chronos"), []stub.Call{
- call("verbosef", stub.ExpectArgs{"inserting entry %s to X11", []any{xhostOp("chronos")}}, nil, nil),
- call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeInsert), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, stub.UniqueError(1)),
- }, &OpError{Op: "xhost", Err: stub.UniqueError(1)}, nil, nil},
-
- {"xcbChangeHosts revert", 0xbeef, hst.EX11, xhostOp("chronos"), []stub.Call{
- call("verbosef", stub.ExpectArgs{"inserting entry %s to X11", []any{xhostOp("chronos")}}, nil, nil),
- call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeInsert), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, nil),
- }, nil, []stub.Call{
- call("verbosef", stub.ExpectArgs{"deleting entry %s from X11", []any{xhostOp("chronos")}}, nil, nil),
- call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeDelete), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, stub.UniqueError(0)),
- }, &OpError{Op: "xhost", Err: stub.UniqueError(0), Revert: true}},
-
- {"success skip", 0xbeef, 0, xhostOp("chronos"), []stub.Call{
- call("verbosef", stub.ExpectArgs{"inserting entry %s to X11", []any{xhostOp("chronos")}}, nil, nil),
- call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeInsert), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, nil),
- }, nil, []stub.Call{
- call("verbosef", stub.ExpectArgs{"skipping entry %s in X11", []any{xhostOp("chronos")}}, nil, nil),
- }, nil},
-
- {"success", 0xbeef, hst.EX11, xhostOp("chronos"), []stub.Call{
- call("verbosef", stub.ExpectArgs{"inserting entry %s to X11", []any{xhostOp("chronos")}}, nil, nil),
- call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeInsert), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, nil),
- }, nil, []stub.Call{
- call("verbosef", stub.ExpectArgs{"deleting entry %s from X11", []any{xhostOp("chronos")}}, nil, nil),
- call("xcbChangeHosts", stub.ExpectArgs{xcb.HostMode(xcb.HostModeDelete), xcb.Family(xcb.FamilyServerInterpreted), "localuser\x00chronos"}, nil, nil),
- }, nil},
- })
-
- checkOpsBuilder(t, "ChangeHosts", []opsBuilderTestCase{
- {"xhost", 0xcafe, func(_ *testing.T, sys *I) {
- sys.ChangeHosts("chronos")
- }, []Op{
- xhostOp("chronos"),
- }, stub.Expect{}},
- })
-
- checkOpIs(t, []opIsTestCase{
- {"differs", xhostOp("kbd"), xhostOp("chronos"), false},
- {"equals", xhostOp("chronos"), xhostOp("chronos"), true},
- })
-
- checkOpMeta(t, []opMetaTestCase{
- {"xhost", xhostOp("chronos"), hst.EX11, "/tmp/.X11-unix", "SI:localuser:chronos"},
- })
-}