restic: add IDSet.Clone() method
This commit is contained in:
parent
72482ce5bd
commit
ad98fbf7dd
2 changed files with 9 additions and 0 deletions
|
@ -105,3 +105,9 @@ func (s IDSet) String() string {
|
||||||
str := s.List().String()
|
str := s.List().String()
|
||||||
return "{" + str[1:len(str)-1] + "}"
|
return "{" + str[1:len(str)-1] + "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s IDSet) Clone() IDSet {
|
||||||
|
c := NewIDSet()
|
||||||
|
c.Merge(s)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
|
@ -35,4 +35,7 @@ func TestIDSet(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
rtest.Equals(t, "{1285b303 7bb086db f658198b}", set.String())
|
rtest.Equals(t, "{1285b303 7bb086db f658198b}", set.String())
|
||||||
|
|
||||||
|
copied := set.Clone()
|
||||||
|
rtest.Equals(t, "{1285b303 7bb086db f658198b}", copied.String())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue