aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--playlist.go1
-rw-r--r--playlist_test.go8
2 files changed, 8 insertions, 1 deletions
diff --git a/playlist.go b/playlist.go
index bc410e3..049354e 100644
--- a/playlist.go
+++ b/playlist.go
@@ -31,7 +31,6 @@ func (pl *Playlist) Pop() any {
n := len(old)
s := old[n-1]
old[n-1] = nil // avoid memory leak
- s.index = -1 // for safety
*pl = old[0 : n-1]
return s
}
diff --git a/playlist_test.go b/playlist_test.go
index bb236ee..4829779 100644
--- a/playlist_test.go
+++ b/playlist_test.go
@@ -148,3 +148,11 @@ func TestPlOrderedList(t *testing.T) {
t.Fail()
}
}
+
+func TestRemoveAfterOrderedList(t *testing.T) {
+ var pl Playlist
+ s := NewDummySong("Foo", "Bar")
+ pl.Add(s)
+ pl.OrderedList()
+ pl.RemoveSong(s)
+}