@@ -52,42 +52,47 @@ func TestReadSandboxToolConfigMissingFile(t *testing.T) {
5252}
5353
5454func TestValidateSandboxToolAllowsSbx (t * testing.T ) {
55- if err := validateSandboxTool ("sbx" ); err != nil {
55+ tool , err := validateSandboxTool ("sbx" )
56+ if err != nil {
5657 t .Fatalf ("validateSandboxTool() error = %v" , err )
5758 }
59+
60+ if tool != "sbx" {
61+ t .Fatalf ("validateSandboxTool() = %q, want %q" , tool , "sbx" )
62+ }
5863}
5964
6065func TestValidateSandboxToolRejectsUnsupportedTool (t * testing.T ) {
61- err := validateSandboxTool ("firejail" )
66+ _ , err := validateSandboxTool ("firejail" )
6267 if err == nil {
6368 t .Fatal ("validateSandboxTool() error = nil, want error" )
6469 }
6570}
6671
67- func TestSandboxConfigCommandRejectsUnsupportedKey (t * testing.T ) {
68- cmd := newSandboxConfigCmd ()
72+ func TestConfigCommandRejectsUnsupportedKey (t * testing.T ) {
73+ cmd := newConfigCmd ()
6974 cmd .SetArgs ([]string {"unsupported.key" , "sbx" })
7075
7176 if err := cmd .Execute (); err == nil {
7277 t .Fatal ("config command error = nil, want error" )
7378 }
7479}
7580
76- func TestSandboxConfigCommandRejectsUnsupportedTool (t * testing.T ) {
81+ func TestConfigCommandRejectsUnsupportedTool (t * testing.T ) {
7782 t .Setenv ("XDG_CONFIG_HOME" , t .TempDir ())
7883
79- cmd := newSandboxConfigCmd ()
84+ cmd := newConfigCmd ()
8085 cmd .SetArgs ([]string {"sandbox.tool" , "firejail" })
8186
8287 if err := cmd .Execute (); err == nil {
8388 t .Fatal ("config command error = nil, want error" )
8489 }
8590}
8691
87- func TestSandboxConfigCommandWritesConfig (t * testing.T ) {
92+ func TestConfigCommandWritesSandboxToolConfig (t * testing.T ) {
8893 t .Setenv ("XDG_CONFIG_HOME" , t .TempDir ())
8994
90- cmd := newSandboxConfigCmd ()
95+ cmd := newConfigCmd ()
9196 cmd .SetArgs ([]string {"sandbox.tool" , "sbx" })
9297
9398 if err := cmd .Execute (); err != nil {
@@ -104,14 +109,16 @@ func TestSandboxConfigCommandWritesConfig(t *testing.T) {
104109 }
105110}
106111
107- func TestLaunchCommandRequiresConfiguredSandboxTool (t * testing.T ) {
112+ func TestConfiguredSandboxToolMissingConfig (t * testing.T ) {
108113 t .Setenv ("XDG_CONFIG_HOME" , t .TempDir ())
109114
110- cmd := newLaunchCmd ()
111- cmd .SetArgs ([]string {"opencode" })
115+ got , err := configuredSandboxTool ()
116+ if err != nil {
117+ t .Fatalf ("configuredSandboxTool() error = %v" , err )
118+ }
112119
113- if err := cmd . Execute (); err == nil {
114- t .Fatal ( "launch command error = nil , want error" )
120+ if got != "" {
121+ t .Fatalf ( "configuredSandboxTool() = %q , want empty string" , got )
115122 }
116123}
117124
0 commit comments