diff --git a/file.go b/file.go index 4b10e78..58748a7 100644 --- a/file.go +++ b/file.go @@ -55,7 +55,7 @@ func (file File) RawURI() string { // See RawURI to just get the string value of it. // String implements the fmt.Stringer interface. func (file File) String() string { - return fmt.Sprintf("%q (%s)", file.Path(), file.FileSystem().Name()) + return fmt.Sprintf("%s: %s", file.FileSystem().Name(), file.Path()) } // URL of the file diff --git a/file_test.go b/file_test.go index 5c73023..1b8f693 100644 --- a/file_test.go +++ b/file_test.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "path/filepath" "testing" "time" @@ -12,10 +13,6 @@ import ( "github.com/ungerik/go-fs/fsimpl" ) -func X(t *testing.T) { - t.Log("X") -} - func TestInvalidFile(t *testing.T) { assert.False(t, InvalidFile.IsDir(), "InvalidFile does not exist") @@ -228,3 +225,8 @@ func TestFile_ListDirInfoRecursiveContext(t *testing.T) { }) } } + +func TestFile_String(t *testing.T) { + path := filepath.Join("dir", "file.ext") + require.Equal(t, "local file system: "+path, File(path).String()) +}