From 1c1f0f5be4436a6454e17e166f0e950ff30b48c3 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sat, 26 Oct 2019 14:11:19 -0400 Subject: Refactor context naming to reduce confusion Signed-off-by: Dave Henderson --- context_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'context_test.go') diff --git a/context_test.go b/context_test.go index f2780356..37362104 100644 --- a/context_test.go +++ b/context_test.go @@ -11,20 +11,20 @@ import ( ) func TestEnvMapifiesEnvironment(t *testing.T) { - c := &context{} + c := &tmplctx{} env := c.Env() assert.Equal(t, env["USER"], os.Getenv("USER")) } func TestEnvGetsUpdatedEnvironment(t *testing.T) { - c := &context{} + c := &tmplctx{} assert.Empty(t, c.Env()["FOO"]) assert.NoError(t, os.Setenv("FOO", "foo")) assert.Equal(t, c.Env()["FOO"], "foo") } func TestCreateContext(t *testing.T) { - c, err := createContext(nil, nil) + c, err := createTmplContext(nil, nil) assert.NoError(t, err) assert.Empty(t, c) @@ -40,16 +40,16 @@ func TestCreateContext(t *testing.T) { } os.Setenv("foo", "foo: bar") defer os.Unsetenv("foo") - c, err = createContext([]string{"foo=" + fooURL}, d) + c, err = createTmplContext([]string{"foo=" + fooURL}, d) assert.NoError(t, err) - assert.IsType(t, &context{}, c) - ctx := c.(*context) + assert.IsType(t, &tmplctx{}, c) + ctx := c.(*tmplctx) ds := ((*ctx)["foo"]).(map[string]interface{}) assert.Equal(t, "bar", ds["foo"]) os.Setenv("bar", "bar: baz") defer os.Unsetenv("bar") - c, err = createContext([]string{".=" + barURL}, d) + c, err = createTmplContext([]string{".=" + barURL}, d) assert.NoError(t, err) assert.IsType(t, map[string]interface{}{}, c) ds = c.(map[string]interface{}) -- cgit v1.2.3