diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-07-28 13:07:16 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-07-28 13:07:16 +0200 |
| commit | 7471cb64e9b7d8e6b1cabb07751181bbfdf3237c (patch) | |
| tree | 35ef4c43312bdb0bc9214d83f43c368043104825 /playlist_test.go | |
| parent | 1fbf611500260cb78b36abd5cf95feeb211be6bc (diff) | |
| download | WRMS-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.go | 15 |
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() + } +} |
