From e14e45d0878a264d9dfd700ed9017088a01ee21a Mon Sep 17 00:00:00 2001 From: Jeremy Saenz Date: Sat, 20 Jul 2013 15:53:25 -0700 Subject: [PATCH] More test tweaking --- context_test.go | 23 ++++++++++++----------- helpers_test.go | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/context_test.go b/context_test.go index 3c6bab5..6e342fc 100644 --- a/context_test.go +++ b/context_test.go @@ -1,45 +1,46 @@ -package cli +package cli_test import ( "flag" "testing" + "github.com/codegangsta/cli" ) -func Test_New(t *testing.T) { +func TestNewContext(t *testing.T) { set := flag.NewFlagSet("test", 0) set.Int("myflag", 12, "doc") globalSet := flag.NewFlagSet("test", 0) globalSet.Int("myflag", 42, "doc") - c := NewContext(nil, set, globalSet) + c := cli.NewContext(nil, set, globalSet) expect(t, c.Int("myflag"), 12) expect(t, c.GlobalInt("myflag"), 42) } -func Test_Int(t *testing.T) { +func TestContext_Int(t *testing.T) { set := flag.NewFlagSet("test", 0) set.Int("myflag", 12, "doc") - c := NewContext(nil, set, set) + c := cli.NewContext(nil, set, set) expect(t, c.Int("myflag"), 12) } -func Test_String(t *testing.T) { +func TestContext_String(t *testing.T) { set := flag.NewFlagSet("test", 0) set.String("myflag", "hello world", "doc") - c := NewContext(nil, set, set) + c := cli.NewContext(nil, set, set) expect(t, c.String("myflag"), "hello world") } -func Test_Bool(t *testing.T) { +func TestContext_Bool(t *testing.T) { set := flag.NewFlagSet("test", 0) set.Bool("myflag", false, "doc") - c := NewContext(nil, set, set) + c := cli.NewContext(nil, set, set) expect(t, c.Bool("myflag"), false) } -func Test_Args(t *testing.T) { +func TestContext_Args(t *testing.T) { set := flag.NewFlagSet("test", 0) set.Bool("myflag", false, "doc") - c := NewContext(nil, set, set) + c := cli.NewContext(nil, set, set) set.Parse([]string{"--myflag", "bat", "baz"}) expect(t, len(c.Args()), 2) expect(t, c.Bool("myflag"), true) diff --git a/helpers_test.go b/helpers_test.go index 3ce8e93..cdc4feb 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -1,4 +1,4 @@ -package cli +package cli_test import ( "reflect"