diff options
Diffstat (limited to 'browserenv_unix_test.go')
-rw-r--r-- | browserenv_unix_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/browserenv_unix_test.go b/browserenv_unix_test.go index f79d31d..971454e 100644 --- a/browserenv_unix_test.go +++ b/browserenv_unix_test.go @@ -96,3 +96,23 @@ func TestOpenURLStderr(t *testing.T) { t.Errorf("got stdout value %q want %q", got, url) } } + +func TestOpenURLMultipleBrowserCommands(t *testing.T) { + // The `test -z URL` command must fail, causing `printf URL` to run. + err := os.Setenv("BROWSER", "test -z:printf") + if err != nil { + t.Fatal(err) + } + + var stdout strings.Builder + Stdout = &stdout + + url := "http://localhost:8000" + + OpenURL(url) + + got := stdout.String() + if got != url { + t.Errorf("got stdout value %q want %q", got, url) + } +} |