aboutsummaryrefslogtreecommitdiff
path: root/playlist_test.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-07-28 13:07:16 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-07-28 13:07:16 +0200
commit7471cb64e9b7d8e6b1cabb07751181bbfdf3237c (patch)
tree35ef4c43312bdb0bc9214d83f43c368043104825 /playlist_test.go
parent1fbf611500260cb78b36abd5cf95feeb211be6bc (diff)
downloadWRMS-7471cb64e9b7d8e6b1cabb07751181bbfdf3237c.tar.gz
WRMS-7471cb64e9b7d8e6b1cabb07751181bbfdf3237c.zip
fix copying of the playlist when creating an ordered list
Go's copy builtin does only copy min(len(dest), len(src)) elements, since we create an empty destination slice with a big enough capacity copy does not actually copy anything.
Diffstat (limited to 'playlist_test.go')
-rw-r--r--playlist_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/playlist_test.go b/playlist_test.go
index 8730737..bb236ee 100644
--- a/playlist_test.go
+++ b/playlist_test.go
@@ -133,3 +133,18 @@ func TestPlAdd3AdjustAdjustPop(t *testing.T) {
t.Fail()
}
}
+
+func TestPlOrderedList(t *testing.T) {
+ var pl Playlist
+ s := NewDummySong("Foo", "Bar")
+ pl.Add(s)
+ l := pl.OrderedList()
+ if len(pl) != len(l) {
+ t.Log("size of pl and ordered list differs")
+ t.Fail()
+ }
+ if pl[0] != l[0] {
+ t.Log("element of pl and ordered list differs")
+ t.Fail()
+ }
+}