From f14b9c0d819a4f2b73e7b36bd4ecc27092c2d9d3 Mon Sep 17 00:00:00 2001 From: Jeremy Saenz Date: Fri, 19 Jul 2013 14:59:57 -0700 Subject: [PATCH] JMS #4: Better tests --- cli_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cli_test.go b/cli_test.go index 813bfe7..1b362d3 100644 --- a/cli_test.go +++ b/cli_test.go @@ -6,6 +6,7 @@ import ( ) func Test_SettingFlags(t *testing.T) { + msg := "" app := NewApp() app.Flags = []Flag{ StringFlag{"foo", "default", "a string flag"}, @@ -16,11 +17,14 @@ func Test_SettingFlags(t *testing.T) { expect(t, c.String("foo"), "hello world") expect(t, c.Int("bar"), 245) expect(t, c.Bool("bat"), true) + msg = "foobar" } app.Run([]string{"command", "--foo", "hello world", "--bar", "245", "--bat"}) + expect(t, msg, "foobar") } func Test_FlagDefaults(t *testing.T) { + msg := "" app := NewApp() app.Flags = []Flag{ StringFlag{"foo", "default", "a string flag"}, @@ -31,8 +35,10 @@ func Test_FlagDefaults(t *testing.T) { expect(t, c.String("foo"), "default") expect(t, c.Int("bar"), 42) expect(t, c.Bool("bat"), false) + msg = "foobar" } app.Run([]string{"command"}) + expect(t, msg, "foobar") } func TestCommands(t *testing.T) {