Skip to content

Commit

Permalink
filepath.IsAbs to check for absolute path
Browse files Browse the repository at this point in the history
`strings.HasPrefix(.., '/')` is Unix specific.
  • Loading branch information
abhinav committed Nov 21, 2021
1 parent f551a8a commit be3f494
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"net/url"
"os"
"path/filepath"
"strings"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -52,7 +51,7 @@ func TestOpenNoPaths(t *testing.T) {
func TestOpen(t *testing.T) {
tempName := tempFileName("", "zap-open-test")
assert.False(t, fileExists(tempName))
require.True(t, strings.HasPrefix(tempName, "/"), "Expected absolute temp file path.")
require.True(t, filepath.IsAbs(tempName), "Expected absolute temp file path.")

tests := []struct {
paths []string
Expand Down

0 comments on commit be3f494

Please sign in to comment.