diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2023-04-29 13:08:53 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2023-04-29 13:08:53 -0400 |
| commit | 3b7a37cca4048c2cdc92982ad4f4965efccf947a (patch) | |
| tree | a4678bd9674951f7bed5b10f4db327471ed6b66e /context_test.go | |
| parent | 185a45a03f77968874beed630a7cfa83546dcf03 (diff) | |
Use required.NoError for faster failure in tests
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'context_test.go')
| -rw-r--r-- | context_test.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/context_test.go b/context_test.go index 00ce6330..8fd4da71 100644 --- a/context_test.go +++ b/context_test.go @@ -9,6 +9,7 @@ import ( "github.com/hairyhenderson/gomplate/v4/data" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestEnvMapifiesEnvironment(t *testing.T) { @@ -20,14 +21,14 @@ func TestEnvMapifiesEnvironment(t *testing.T) { func TestEnvGetsUpdatedEnvironment(t *testing.T) { c := &tmplctx{} assert.Empty(t, c.Env()["FOO"]) - assert.NoError(t, os.Setenv("FOO", "foo")) + require.NoError(t, os.Setenv("FOO", "foo")) assert.Equal(t, c.Env()["FOO"], "foo") } func TestCreateContext(t *testing.T) { ctx := context.Background() c, err := createTmplContext(ctx, nil, nil) - assert.NoError(t, err) + require.NoError(t, err) assert.Empty(t, c) fooURL := "env:///foo?type=application/yaml" @@ -44,7 +45,7 @@ func TestCreateContext(t *testing.T) { os.Setenv("foo", "foo: bar") defer os.Unsetenv("foo") c, err = createTmplContext(ctx, []string{"foo"}, d) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, &tmplctx{}, c) tctx := c.(*tmplctx) ds := ((*tctx)["foo"]).(map[string]interface{}) @@ -53,7 +54,7 @@ func TestCreateContext(t *testing.T) { os.Setenv("bar", "bar: baz") defer os.Unsetenv("bar") c, err = createTmplContext(ctx, []string{"."}, d) - assert.NoError(t, err) + require.NoError(t, err) assert.IsType(t, map[string]interface{}{}, c) ds = c.(map[string]interface{}) assert.Equal(t, "baz", ds["bar"]) |
