2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-17 00:02:49 +00:00
restic/internal/restic/ids_test.go
greatroar 63bed34608 restic: Clean up restic.IDs type
IDs.Less can be rewritten as

	string(list[i][:]) < string(list[j][:])

Note that this does not copy the ID's.

The Uniq method was no longer used.

The String method has been reimplemented without first copying into a
separate slice of a custom type.
2022-12-03 12:38:20 +01:00

18 lines
454 B
Go

package restic
import (
"testing"
rtest "github.com/restic/restic/internal/test"
)
func TestIDsString(t *testing.T) {
ids := IDs{
TestParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
TestParseID("1285b30394f3b74693cc29a758d9624996ae643157776fce8154aabd2f01515f"),
TestParseID("7bb086db0d06285d831485da8031281e28336a56baa313539eaea1c73a2a1a40"),
}
rtest.Equals(t, "[7bb086db 1285b303 7bb086db]", ids.String())
}