]> code.delx.au - gnu-emacs-elpa/blob - packages/test-simple/test/test-fns.el
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[gnu-emacs-elpa] / packages / test-simple / test / test-fns.el
1 ;;; test-simple.el --- Simple Unit Test Framework for Emacs Lisp
2 ;; Copyright (C) 2015 Free Software Foundation, Inc
3 ;; Author: Rocky Bernstein <rocky@gnu.org>
4 ;; This program is free software: you can redistribute it and/or
5 ;; modify it under the terms of the GNU General Public License as
6 ;; published by the Free Software Foundation, either version 3 of the
7 ;; License, or (at your option) any later version.
8
9 ;; This program is distributed in the hope that it will be useful, but
10 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 ;; General Public License for more details.
13
14 ;; You should have received a copy of the GNU General Public License
15 ;; along with this program. If not, see
16 ;; <http://www.gnu.org/licenses/>.
17 (require 'cl)
18 (load-file "../test-simple.el")
19 (test-simple-clear)
20
21 (setq test-info (make-test-info))
22 (test-simple-clear test-info)
23
24 (note "Initializing test information")
25 (assert-equal 0 (test-info-assert-count test-info) "Count zeroed")
26 (assert-equal 0 (test-info-failure-count test-info) "Failure zeroed")
27
28 (note "Summary information")
29 (assert-matches "0 failures in 0 assertions" (test-simple-summary-line test-info)
30 "initial summary")
31 (incf (test-info-assert-count test-info))
32 (incf (test-info-failure-count test-info))
33 (assert-matches "1 failure in 1 assertion" (test-simple-summary-line test-info)
34 "handling singular correctly")
35 (incf (test-info-assert-count test-info))
36 (assert-matches "1 failure in 2 assertions" (test-simple-summary-line test-info)
37 "back to plural for two assertions")
38
39 (end-tests)