From eb22a8bcc1ac03357d4073e5d3ed6d0ab5246a37 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Wed, 2 Jul 2025 20:42:51 +0900 Subject: cmd/hakurei: move to cmd Having it at the project root never made sense since the "ego" name was deprecated. This change finally addresses it. Signed-off-by: Ophestra --- main_test.go | 81 ------------------------------------------------------------ 1 file changed, 81 deletions(-) delete mode 100644 main_test.go (limited to 'main_test.go') diff --git a/main_test.go b/main_test.go deleted file mode 100644 index 7e2b792e..00000000 --- a/main_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package main - -import ( - "bytes" - "errors" - "flag" - "testing" - - "git.gensokyo.uk/security/hakurei/command" -) - -func TestHelp(t *testing.T) { - testCases := []struct { - name string - args []string - want string - }{ - { - "main", []string{}, ` -Usage: hakurei [-h | --help] [-v] [--json] COMMAND [OPTIONS] - -Commands: - app Load app from configuration file - run Configure and start a permissive default sandbox - show Show live or local app configuration - ps List active instances - version Display version information - license Show full license text - template Produce a config template - help Show this help message - -`, - }, - { - "run", []string{"run", "-h"}, ` -Usage: hakurei run [-h | --help] [--dbus-config ] [--dbus-system ] [--mpris] [--dbus-log] [--id ] [-a ] [-g ] [-d ] [-u ] [--wayland] [-X] [--dbus] [--pulse] COMMAND [OPTIONS] - -Flags: - -X Enable direct connection to X11 - -a int - Application identity - -d string - Container home directory (default "os") - -dbus - Enable proxied connection to D-Bus - -dbus-config string - Path to session bus proxy config file, or "builtin" for defaults (default "builtin") - -dbus-log - Force buffered logging in the D-Bus proxy - -dbus-system string - Path to system bus proxy config file, or "nil" to disable (default "nil") - -g value - Groups inherited by all container processes - -id string - Reverse-DNS style Application identifier, leave empty to inherit instance identifier - -mpris - Allow owning MPRIS D-Bus path, has no effect if custom config is available - -pulse - Enable direct connection to PulseAudio - -u string - Passwd user name within sandbox (default "chronos") - -wayland - Enable connection to Wayland via security-context-v1 - -`, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - out := new(bytes.Buffer) - c := buildCommand(out) - if err := c.Parse(tc.args); !errors.Is(err, command.ErrHelp) && !errors.Is(err, flag.ErrHelp) { - t.Errorf("Parse: error = %v; want %v", - err, command.ErrHelp) - } - if got := out.String(); got != tc.want { - t.Errorf("Parse: %s want %s", got, tc.want) - } - }) - } -} -- cgit v1.3.1