diff options
| author | Glenn Morris <rgm@gnu.org> | 2020-06-07 09:03:59 -0700 |
|---|---|---|
| committer | Glenn Morris <rgm@gnu.org> | 2020-06-07 09:03:59 -0700 |
| commit | fa6d56529f9ebaedaf62ecbf8887ffecca7dce12 (patch) | |
| tree | 922e12ffbf813534647a96788b9a5fb77b4f2288 /test/lisp/battery-tests.el | |
| parent | 6cb557e7a58d7f1c2e9afceeba45d0ced2aff214 (diff) | |
| parent | 35661ef943d261f6c43e93e475ddd8516f4a4b62 (diff) | |
| download | emacs-fa6d56529f9ebaedaf62ecbf8887ffecca7dce12.tar.gz | |
Merge from origin/emacs-27
35661ef943 (origin/emacs-27) Fix typo in "(elisp) Type Keywords"
1af0e95fec Gnus nnir-summary-line-format has no effect
dd366b5d3b Improve documentation of 'window-text-pixel-size'
fbd49f969e * src/xdisp.c (Fwindow_text_pixel_size): Doc fix. (Bug#41...
d8593fd19f Minor improvements to EDE and EIEIO manuals
3916e63f9e Have Fido mode also imitate Ido mode in ignore-case options
cc35b197c7 Update package-menu-quick-help
bf09106256 Improve documentation of 'sort-subr'
73749efa13 Update Ukrainian transliteration
30a7ee505a Fix Arabic shaping when eww/shr fill the text to be rendered
7d323f07c0 Silence some byte-compiler warnings in tests
cf473e742f * test/lisp/battery-tests.el: New file.
b07e3b1d97 Improve format-spec documentation (bug#41571)
# Conflicts:
# test/lisp/emacs-lisp/package-tests.el
Diffstat (limited to 'test/lisp/battery-tests.el')
| -rw-r--r-- | test/lisp/battery-tests.el | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/lisp/battery-tests.el b/test/lisp/battery-tests.el new file mode 100644 index 00000000000..052ae49a800 --- /dev/null +++ b/test/lisp/battery-tests.el @@ -0,0 +1,58 @@ +;;; battery-tests.el --- tests for battery.el -*- lexical-binding: t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Code: + +(require 'battery) + +(ert-deftest battery-linux-proc-apm-regexp () + "Test `battery-linux-proc-apm-regexp'." + (let ((str "1.16 1.2 0x07 0x01 0xff 0x80 -1% -1 ?")) + (should (string-match battery-linux-proc-apm-regexp str)) + (should (equal (match-string 0 str) str)) + (should (equal (match-string 1 str) "1.16")) + (should (equal (match-string 2 str) "1.2")) + (should (equal (match-string 3 str) "07")) + (should (equal (match-string 4 str) "01")) + (should (equal (match-string 5 str) "ff")) + (should (equal (match-string 6 str) "80")) + (should (equal (match-string 7 str) "-1")) + (should (equal (match-string 8 str) "-1")) + (should (equal (match-string 9 str) "?"))) + (let ((str "1.16 1.2 0x03 0x00 0x00 0x01 99% 1792 min")) + (should (string-match battery-linux-proc-apm-regexp str)) + (should (equal (match-string 0 str) str)) + (should (equal (match-string 1 str) "1.16")) + (should (equal (match-string 2 str) "1.2")) + (should (equal (match-string 3 str) "03")) + (should (equal (match-string 4 str) "00")) + (should (equal (match-string 5 str) "00")) + (should (equal (match-string 6 str) "01")) + (should (equal (match-string 7 str) "99")) + (should (equal (match-string 8 str) "1792")) + (should (equal (match-string 9 str) "min")))) + +(ert-deftest battery-format () + "Test `battery-format'." + (should (equal (battery-format "" ()) "")) + (should (equal (battery-format "" '((?b . "-"))) "")) + (should (equal (battery-format "%a%b%p%%" '((?b . "-") (?p . "99"))) + "-99%"))) + +;;; battery-tests.el ends here |
