Browse Source

Add tests for entity-parent

tags/v0.7.0
Damien Cassou 2 years ago
parent
commit
ac1eda1c4b
No known key found for this signature in database GPG Key ID: A7123815F5DCE914
2 changed files with 14 additions and 1 deletions
  1. +1
    -1
      libmpdel.el
  2. +13
    -0
      test/libmpdel-test.el

+ 1
- 1
libmpdel.el View File

@@ -204,7 +204,7 @@ message from the server.")
(libmpdel--stored-playlist-name stored-playlist))

(cl-defgeneric libmpdel-entity-parent (_entity)
"Return parent of _ENTITY."
"Return parent of ENTITY."
nil)

(cl-defmethod libmpdel-entity-parent ((song libmpdel-song))


+ 13
- 0
test/libmpdel-test.el View File

@@ -82,6 +82,19 @@
(should (equal "The song" (libmpdel-entity-name song)))
(should (equal "The playlist" (libmpdel-entity-name stored-playlist)))))

(ert-deftest libmpdel-entity-parent ()
(let* ((artist (libmpdel--artist-create :name "The Artist"))
(album (libmpdel--album-create :name "The Album" :artist artist))
(song (libmpdel--song-create :name "The song" :album album))
(stored-playlist (libmpdel--stored-playlist-create :name "The playlist")))
(should (equal 'artists (libmpdel-entity-parent artist)))
(should (equal artist (libmpdel-entity-parent album)))
(should (equal album (libmpdel-entity-parent song)))
(should (equal 'stored-playlists (libmpdel-entity-parent stored-playlist)))
(should-not (libmpdel-entity-parent 'stored-playlists))
(should-not (libmpdel-entity-parent 'artists))
(should-not (libmpdel-entity-parent 'current-playlist))))

;;; Helper functions



Loading…
Cancel
Save