Fail early in TestGetRealPath
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 18 Sep 2016 17:52:42 +0000 (19:52 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 18 Sep 2016 17:52:42 +0000 (19:52 +0200)
See #2476

helpers/path_test.go

index bd8f8ed4953ec69b62683b4dec66370fbc7844f5..9ce61b26972ce65fb313e0a62a15a7ce2f8e8064 100644 (file)
@@ -25,6 +25,8 @@ import (
        "testing"
        "time"
 
+       "github.com/stretchr/testify/require"
+
        "github.com/stretchr/testify/assert"
 
        "github.com/spf13/afero"
@@ -149,16 +151,16 @@ func TestGetRealPath(t *testing.T) {
        fs := afero.NewOsFs()
 
        rp1, err := GetRealPath(fs, d1)
-       assert.NoError(t, err)
+       require.NoError(t, err)
        assert.Equal(t, d1, rp1)
 
        sym := filepath.Join(os.TempDir(), "d1sym")
        err = os.Symlink(d1, sym)
+       require.NoError(t, err)
        defer os.Remove(sym)
-       assert.NoError(t, err)
 
        rp2, err := GetRealPath(fs, sym)
-       assert.NoError(t, err)
+       require.NoError(t, err)
 
        // On OS X, the temp folder is itself a symbolic link (to /private...)
        // This has to do for now.