@@ -11,10 +11,10 @@ func TestForOS(t *testing.T) {
1111 url string
1212 }
1313 tests := []struct {
14- name string
15- args args
16- findExe bool
17- want []string
14+ name string
15+ args args
16+ exe string
17+ want []string
1818 }{
1919 {
2020 name : "macOS" ,
@@ -30,17 +30,17 @@ func TestForOS(t *testing.T) {
3030 goos : "linux" ,
3131 url : "https://example.com/path?a=1&b=2" ,
3232 },
33- findExe : false , // wslview does not exist on standard Linux
34- want : []string {"xdg-open" , "https://example.com/path?a=1&b=2" },
33+ exe : "xdg-open" ,
34+ want : []string {"xdg-open" , "https://example.com/path?a=1&b=2" },
3535 },
3636 {
3737 name : "WSL" ,
3838 args : args {
3939 goos : "linux" ,
4040 url : "https://example.com/path?a=1&b=2" ,
4141 },
42- findExe : true , // wslview exists on WSL
43- want : []string {"wslview" , "https://example.com/path?a=1&b=2" },
42+ exe : " wslview" ,
43+ want : []string {"wslview" , "https://example.com/path?a=1&b=2" },
4444 },
4545 {
4646 name : "Windows" ,
@@ -53,7 +53,7 @@ func TestForOS(t *testing.T) {
5353 }
5454 for _ , tt := range tests {
5555 t .Run (tt .name , func (t * testing.T ) {
56- findExe = func (string ) bool { return tt .findExe }
56+ linuxExe = func () string { return tt .exe }
5757 if cmd := ForOS (tt .args .goos , tt .args .url ); ! reflect .DeepEqual (cmd .Args , tt .want ) {
5858 t .Errorf ("ForOS() = %v, want %v" , cmd .Args , tt .want )
5959 }
0 commit comments