aboutsummaryrefslogtreecommitdiffstats
path: root/browserenv_unix_test.go
diff options
context:
space:
mode:
authorTeddy Wing2020-12-20 02:49:54 +0100
committerTeddy Wing2020-12-20 02:52:24 +0100
commit4db1ee53efc7481b689ebee69b5381d63fe59419 (patch)
tree7e833e04e8f69b71228e4100bd6dd29969545130 /browserenv_unix_test.go
parent3dca44be5342384334020c8f64752caaf86d334d (diff)
downloadbrowserenv-4db1ee53efc7481b689ebee69b5381d63fe59419.tar.bz2
Handle `%s` format string for URL in `BROWSER` variable
The `BROWSER` environment variable might contain a `%s` format string that should be replaced by the URL to open. If it's present perform the replacement. Otherwise, append the URL to the `BROWSER` command as before.
Diffstat (limited to 'browserenv_unix_test.go')
-rw-r--r--browserenv_unix_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/browserenv_unix_test.go b/browserenv_unix_test.go
index 35af81c..f49444e 100644
--- a/browserenv_unix_test.go
+++ b/browserenv_unix_test.go
@@ -21,6 +21,18 @@ func TestBrowserCommand(t *testing.T) {
"https://duckduckgo.com",
"open -a Firefox 'https://duckduckgo.com'",
},
+ {
+ "with URL directive at end",
+ "open -a Firefox %s",
+ "https://duckduckgo.com",
+ "open -a Firefox https://duckduckgo.com",
+ },
+ {
+ "with URL directive in middle",
+ "open -a Firefox %s --other-arg",
+ "https://duckduckgo.com",
+ "open -a Firefox https://duckduckgo.com --other-arg",
+ },
}
for _, test := range tests {