aboutsummaryrefslogtreecommitdiffhomepage
path: root/system/xhost_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-17 19:00:43 +0900
committerOphestra <cat@gensokyo.uk>2025-02-17 19:00:43 +0900
commit90cb01b2748550228d0bc179691a19ebb996fc36 (patch)
tree06a2e17b578312c3f0734bf4c476e3c2eb5f6908 /system/xhost_test.go
parentb1e1d5627e6532ec719c761846d7f38fe93fcadd (diff)
system: move out of internal
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system/xhost_test.go')
-rw-r--r--system/xhost_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/system/xhost_test.go b/system/xhost_test.go
new file mode 100644
index 00000000..4b364432
--- /dev/null
+++ b/system/xhost_test.go
@@ -0,0 +1,34 @@
+package system
+
+import (
+ "testing"
+)
+
+func TestChangeHosts(t *testing.T) {
+ testCases := []string{"chronos", "keyring", "cat", "kbd", "yonah"}
+ for _, tc := range testCases {
+ t.Run("append ChangeHosts operation for "+tc, func(t *testing.T) {
+ sys := New(150)
+ sys.ChangeHosts(tc)
+ (&tcOp{EX11, tc}).test(t, sys.ops, []Op{
+ XHost(tc),
+ }, "ChangeHosts")
+ })
+ }
+}
+
+func TestXHost_String(t *testing.T) {
+ testCases := []struct {
+ username string
+ want string
+ }{
+ {"chronos", "SI:localuser:chronos"},
+ }
+ for _, tc := range testCases {
+ t.Run(tc.want, func(t *testing.T) {
+ if got := XHost(tc.username).String(); got != tc.want {
+ t.Errorf("String() = %v, want %v", got, tc.want)
+ }
+ })
+ }
+}