summaryrefslogtreecommitdiff
path: root/vendor/github.com/skratchdot/open-golang/open/open_test.go
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-01-12 18:39:45 +0100
committerRuben Pollan <meskio@sindominio.net>2019-01-17 12:30:32 +0100
commitb1247d2d0d51108c910a73891ff3116e5f032ab1 (patch)
treee9948964f0bfb1ad2df3bc7bad02aa1f41ccfbd8 /vendor/github.com/skratchdot/open-golang/open/open_test.go
parentefcb8312e31b5c2261b1a1e95ace55b322cfcc27 (diff)
[pkg] all your deps are vendored to us
Diffstat (limited to 'vendor/github.com/skratchdot/open-golang/open/open_test.go')
-rw-r--r--vendor/github.com/skratchdot/open-golang/open/open_test.go70
1 files changed, 70 insertions, 0 deletions
diff --git a/vendor/github.com/skratchdot/open-golang/open/open_test.go b/vendor/github.com/skratchdot/open-golang/open/open_test.go
new file mode 100644
index 0000000..5db2da2
--- /dev/null
+++ b/vendor/github.com/skratchdot/open-golang/open/open_test.go
@@ -0,0 +1,70 @@
+package open
+
+import "testing"
+
+func TestRun(t *testing.T) {
+ // shouldn't error
+ input := "https://google.com/"
+ err := Run(input)
+ if err != nil {
+ t.Errorf("open.Run(\"%s\") threw an error: %s", input, err)
+ }
+
+ // should error
+ input = "xxxxxxxxxxxxxxx"
+ err = Run(input)
+ if err == nil {
+ t.Errorf("Run(\"%s\") did not throw an error as expected", input)
+ }
+}
+
+func TestStart(t *testing.T) {
+ // shouldn't error
+ input := "https://google.com/"
+ err := Start(input)
+ if err != nil {
+ t.Errorf("open.Start(\"%s\") threw an error: %s", input, err)
+ }
+
+ // shouldn't error
+ input = "xxxxxxxxxxxxxxx"
+ err = Start(input)
+ if err != nil {
+ t.Errorf("open.Start(\"%s\") shouldn't even fail on invalid input: %s", input, err)
+ }
+}
+
+func TestRunWith(t *testing.T) {
+ // shouldn't error
+ input := "https://google.com/"
+ app := "firefox"
+ err := RunWith(input, app)
+ if err != nil {
+ t.Errorf("open.RunWith(\"%s\", \"%s\") threw an error: %s", input, app, err)
+ }
+
+ // should error
+ app = "xxxxxxxxxxxxxxx"
+ err = RunWith(input, app)
+ if err == nil {
+ t.Errorf("RunWith(\"%s\", \"%s\") did not throw an error as expected", input, app)
+ }
+}
+
+func TestStartWith(t *testing.T) {
+ // shouldn't error
+ input := "https://google.com/"
+ app := "firefox"
+ err := StartWith(input, app)
+ if err != nil {
+ t.Errorf("open.StartWith(\"%s\", \"%s\") threw an error: %s", input, app, err)
+ }
+
+ // shouldn't error
+ input = "[<Invalid URL>]"
+ err = StartWith(input, app)
+ if err != nil {
+ t.Errorf("StartWith(\"%s\", \"%s\") shouldn't even fail on invalid input: %s", input, app, err)
+ }
+
+}