fordon_greeman / voidfiles

Branch: main
Switch branches/tags
main
theidioticdev add emacs 2079ec5 1d ago
61 lines · 2.7 KB Raw Blame History
1 ;;; emms-info-native-vorbis-tests.el --- Test suite for emms-info-native-vorbis -*- lexical-binding: t; -*-
2
3 ;; Copyright (C) 2023 Free Software Foundation, Inc.
4
5 ;; Author: Petteri Hintsanen <petterih@iki.fi>
6
7 ;; This file is part of EMMS.
8
9 ;; EMMS is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; any later version.
13
14 ;; EMMS is distributed in the hope that it will be useful, but WITHOUT
15 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 ;; License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with EMMS; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 ;; MA 02110-1301, USA.
23
24 ;;; Code:
25
26 (require 'emms-info-native-vorbis)
27 (require 'ert)
28
29 (ert-deftest emms-test-vorbis-extract-comments ()
30 (let ((comments
31 (quote (((user-comment . "MUSICBRAINZ_RELEASEGROUPID=9b307293-d2e6-34a9-a289-161c5baf187f")
32 (length . 63))
33 ((user-comment . "ORIGINALDATE=1997-03-31")
34 (length . 23))
35 ((user-comment . "ORIGINALYEAR=1997")
36 (length . 17))
37 ((user-comment . "RELEASETYPE=album")
38 (length . 17))
39 ((user-comment . "BARCODE=769233004727")
40 (length . 20))
41 ((user-comment . "ALBUM=A toda Cuba le gusta")
42 (length . 26))))))
43 (should (equal (emms-info-native-vorbis-extract-comments comments)
44 (quote (("album" . "A toda Cuba le gusta")
45 ("originalyear" . "1997")
46 ("originaldate" . "1997-03-31")))))))
47
48 (ert-deftest emms-test-vorbis-split-comment ()
49 (should (equal (emms-info-native-vorbis--split-comment "") nil))
50 (should (equal (emms-info-native-vorbis--split-comment "x") nil))
51 (should (equal (emms-info-native-vorbis--split-comment "x=") nil))
52 (should (equal (emms-info-native-vorbis--split-comment "=x") nil))
53 (should (equal (emms-info-native-vorbis--split-comment "a=B")
54 (cons "a" "B")))
55 (should (equal (emms-info-native-vorbis--split-comment "abc=ABC=123")
56 (cons "abc" "ABC=123")))
57 (let ((comment "Key=\316\237\341\275\220\317\207\341\275\266 \316\244\316\261\341\275\220\317\204\341\275\260"))
58 (should (equal (emms-info-native-vorbis--split-comment comment)
59 (cons "key" "Οὐχὶ Ταὐτὰ")))))
60
61 ;;; emms-info-native-vorbis-tests.el ends here