mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 10:33:34 +00:00
refactor: use strings.Builder to improve performance
This commit is contained in:
@@ -3,6 +3,7 @@ package lsf
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
_ "github.com/rclone/rclone/backend/local"
|
||||
@@ -140,12 +141,12 @@ file3
|
||||
require.NoError(t, err)
|
||||
|
||||
items, _ := list.DirSorted(context.Background(), f, true, "")
|
||||
var expectedOutput string
|
||||
var expectedOutput strings.Builder
|
||||
for _, item := range items {
|
||||
expectedOutput += item.ModTime(context.Background()).Format("2006-01-02 15:04:05") + "\n"
|
||||
expectedOutput.WriteString(item.ModTime(context.Background()).Format("2006-01-02 15:04:05") + "\n")
|
||||
}
|
||||
|
||||
assert.Equal(t, expectedOutput, buf.String())
|
||||
assert.Equal(t, expectedOutput.String(), buf.String())
|
||||
|
||||
buf = new(bytes.Buffer)
|
||||
format = "sp"
|
||||
|
||||
Reference in New Issue
Block a user