Emacs library to communicate with Music Player Daemon (MPD, https://www.musicpd.org/), a flexible, powerful, server-side application for playing music.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

80 lignes
2.8KB

  1. ;;; libmpdel-directory-test.el --- Tests for libmpdel.el -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2019 Damien Cassou
  3. ;; Author: Jose A Ortega <jao@gnu.org>
  4. ;; Url: https://gitlab.petton.fr/mpdel/mpdel
  5. ;; Package-requires: ((emacs "25.1"))
  6. ;; Version: 1.2.0
  7. ;; This program is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation, either version 3 of the License, or
  10. ;; (at your option) any later version.
  11. ;; This program is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. ;;; Commentary:
  18. ;; Tests for libmpdel-directory.el.
  19. ;;; Code:
  20. (require 'ert)
  21. (require 'ert-x)
  22. (require 'cl-lib)
  23. (require 'libmpdel-directory)
  24. ;; Data structure
  25. (ert-deftest libmpdel-directory-test-directory ()
  26. (let* ((path "somewhere/around")
  27. (name "here")
  28. (nameless (libmpdel--directory-create :path path))
  29. (dir (libmpdel--directory-create :path path :name name)))
  30. (should (equal nil (libmpdel--directory-name nameless)))
  31. (should (equal path (libmpdel--directory-path nameless)))
  32. (should (equal name (libmpdel--directory-name dir)))
  33. (should (equal path (libmpdel--directory-path dir)))))
  34. (ert-deftest libmpdel-directory-test-parent ()
  35. (let* ((path "somewhere/around")
  36. (name "here")
  37. (nameless (libmpdel--directory-create :path path))
  38. (dir (libmpdel--directory-create :path path :name name))
  39. (pdir (libmpdel--directory-create :path "somewhere"))
  40. (ppdir (libmpdel-entity-parent (libmpdel-entity-parent dir))))
  41. (should (equal pdir (libmpdel-entity-parent nameless)))
  42. (should (equal pdir (libmpdel-entity-parent dir)))
  43. (should (equal 'directories ppdir))
  44. (should (equal nil (libmpdel-entity-parent ppdir)))
  45. (should (equal ppdir (libmpdel-entity-parent pdir)))
  46. (should (equal nil (libmpdel-entity-parent (libmpdel-entity-parent pdir))))))
  47. (ert-deftest libmpdel-directory-test-entity-to-criteria ()
  48. (let* ((path "somewhere/around")
  49. (name "here")
  50. (nameless (libmpdel--directory-create :path path))
  51. (dir (libmpdel--directory-create :path path :name name)))
  52. (should (equal "lsinfo \"somewhere/around\""
  53. (libmpdel-entity-to-criteria nameless)))
  54. (should (equal "lsinfo \"somewhere/around\""
  55. (libmpdel-entity-to-criteria dir)))))
  56. (provide 'libmpdel-directory-test)
  57. ;;; libmpdel-directory-test.el ends here
  58. ;; Local Variables:
  59. ;; nameless-current-name: "libmpdel-directory-test"
  60. ;; End: