[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 613fe8b 19/26: Version 1.2.0 sync with elpa
From: |
Rocky Bernstein |
Subject: |
[elpa] master 613fe8b 19/26: Version 1.2.0 sync with elpa |
Date: |
Thu, 25 May 2017 02:22:15 -0400 (EDT) |
branch: master
commit 613fe8b3b47ce7120af2cce969284128170e7124
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
Version 1.2.0 sync with elpa
From Stefan Monnier:
* packages/test-simple/test-simple.el: Use cl-lib
* (test-simple-msg): Let-bind inhibit-read-only directly.
* (test-simple--ok-msg, test-simple--not-ok-msg): Rename from ok-msg and
not-ok-msg.
---
README.md | 13 +++++------
test-simple.el | 66 ++++++++++++++++++++++++++++--------------------------
test/test-basic.el | 2 +-
3 files changed, 41 insertions(+), 40 deletions(-)
diff --git a/README.md b/README.md
index dcdbf99..431e054 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,9 @@
*test-simple.el* is :
* Simple -- no need for context macros, enclosing specifications, or required
test tags. But if you want, you still can add custom assert failure messages or
add notes before a group of tests.
-* Accommodates both interactive and non-interactive use:
+* Accomodates both interactive and non-interactive use:
* For interactive use one can use `eval-last-sexp`, `eval-region`, and
`eval-buffer`
- * For non-interactive use run as: `emacs --batch --no-site-file --no-splash
--load <test-lisp-code.el>`, or `test-simple-run`
+ * For non-interactive use run as: `emacs --batch --no-site-file --no-splash
--load <test-lisp-code.el>`
I use this in my [Debugger front end](https://github.com/rocky/emacs-dbgr).
@@ -28,7 +28,7 @@ In file `gcd.el`:
)
-In file `gcd-tests.el` in the same directory:
+In file `test-gcd.el` in the same directory:
(require 'test-simple)
(test-simple-start) ;; Zero counters and start the stop watch.
@@ -51,23 +51,22 @@ In file `gcd-tests.el` in the same directory:
(end-tests) ;; Stop the clock and print a summary
-Edit (with Emacs of course) `gcd-tests.el` and run `M-x eval-current-buffer`
+Edit (with Emacs of course) `test-gcd.el` and run `M-x eval-current-buffer`
You should see in buffer `*test-simple*`:
- gcd-tests.el
+ test-gcd.el
......
0 failures in 6 assertions (0.002646 seconds)
Now let's try from a command line:
- $ emacs --batch --no-site-file --no-splash --load gcd-tests.el
+ $ emacs --batch --no-site-file --no-splash --load test-gcd.el
Loading /src/external-vcs/emacs-test-simple/example/gcd.el (source)...
*scratch*
......
0 failures in 6 assertions (0.000723 seconds)
-
You can run noninteractive tests inside Emacs by `test-simple-run`.
Add the following at a test file:
diff --git a/test-simple.el b/test-simple.el
index 1374de2..26dbf54 100644
--- a/test-simple.el
+++ b/test-simple.el
@@ -1,12 +1,13 @@
;;; test-simple.el --- Simple Unit Test Framework for Emacs Lisp -*-
lexical-binding: t -*-
;; Rewritten from Phil Hagelberg's behave.el by rocky
-;; Copyright (C) 2015 Free Software Foundation, Inc
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc
;; Author: Rocky Bernstein <address@hidden>
;; URL: http://github.com/rocky/emacs-test-simple
;; Keywords: unit-test
-;; Version: 1.1
+;; Package-Requires: ((cl-lib "0"))
+;; Version: 1.2
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
@@ -26,7 +27,7 @@
;; test-simple.el is:
;;
-;; * Simple. No need for
+;; * Simple. No need for
;; - context macros,
;; - enclosing specifications,
;; - required test tags.
@@ -37,7 +38,7 @@
;;
;; * Accommodates both interactive and non-interactive use.
;; - For interactive use, one can use `eval-last-sexp', `eval-region',
-;; and `eval-buffer'. One can `edebug' the code.
+;; and `eval-buffer'. One can `edebug' the code.
;; - For non-interactive use, run:
;; emacs --batch --no-site-file --no-splash --load <test-lisp-code.el>
;;
@@ -81,6 +82,7 @@
;;; To do:
+;; FIXME: Namespace is all messed up!
;; Main issues: more expect predicates
(require 'time-date)
@@ -134,7 +136,7 @@ If bpr is not installed, fall back to `compile'."
"Variable to store testing information for a buffer.")
(defun note (description &optional test-info)
- "Adds a name to a group of tests."
+ "Add a name to a group of tests."
(if (getenv "USE_TAP")
(test-simple-msg (format "# %s" description) 't)
(if (> test-simple-verbosity 0)
@@ -155,9 +157,9 @@ If bpr is not installed, fall back to `compile'."
;;;###autoload
(defun test-simple-clear (&optional test-info test-start-msg)
- "Initializes and resets everything to run tests. You should run
-this before running any assertions. Running more than once clears
-out information from the previous run."
+ "Initialize and reset everything to run tests.
+You should run this before running any assertions. Running more than once
+clears out information from the previous run."
(interactive)
@@ -194,9 +196,9 @@ out information from the previous run."
(list error-condition '(assert-t t)))))
(defun assert-op (op expected actual &optional fail-message test-info)
- "expectation is that ACTUAL should be equal to EXPECTED."
+ "Expectation is that ACTUAL should be equal to EXPECTED."
(unless test-info (setq test-info test-simple-info))
- (incf (test-info-assert-count test-info))
+ (cl-incf (test-info-assert-count test-info))
(if (not (funcall op actual expected))
(let* ((fail-message
(if fail-message
@@ -208,26 +210,26 @@ out information from the previous run."
(if (boundp 'test-info)
(test-info-description test-info)
"unset")))
- (add-failure (format "assert-%s" op) test-info-mess
- (concat fail-message expect-message)))
- (ok-msg fail-message)))
+ (test-simple--add-failure (format "assert-%s" op) test-info-mess
+ (concat fail-message expect-message)))
+ (test-simple--ok-msg fail-message)))
(defun assert-equal (expected actual &optional fail-message test-info)
- "expectation is that ACTUAL should be equal to EXPECTED."
+ "Expectation is that ACTUAL should be equal to EXPECTED."
(assert-op 'equal expected actual fail-message test-info))
(defun assert-eq (expected actual &optional fail-message test-info)
- "expectation is that ACTUAL should be EQ to EXPECTED."
+ "Expectation is that ACTUAL should be EQ to EXPECTED."
(assert-op 'eql expected actual fail-message test-info))
(defun assert-eql (expected actual &optional fail-message test-info)
- "expectation is that ACTUAL should be EQL to EXPECTED."
+ "Expectation is that ACTUAL should be EQL to EXPECTED."
(assert-op 'eql expected actual fail-message test-info))
(defun assert-matches (expected-regexp actual &optional fail-message test-info)
- "expectation is that ACTUAL should match EXPECTED-REGEXP."
+ "Expectation is that ACTUAL should match EXPECTED-REGEXP."
(unless test-info (setq test-info test-simple-info))
- (incf (test-info-assert-count test-info))
+ (cl-incf (test-info-assert-count test-info))
(if (not (string-match expected-regexp actual))
(let* ((fail-message
(if fail-message
@@ -240,8 +242,8 @@ out information from the previous run."
(if (boundp 'test-info)
(test-info-description test-info)
"unset")))
- (add-failure "assert-equal" test-info-mess
- (concat expect-message fail-message)))
+ (test-simple--add-failure "assert-equal" test-info-mess
+ (concat expect-message fail-message)))
(progn (test-simple-msg ".") t)))
(defun assert-t (actual &optional fail-message test-info)
@@ -252,7 +254,7 @@ out information from the previous run."
"expectation is that ACTUAL is nil. FAIL-MESSAGE is an optional
additional message to be displayed."
(unless test-info (setq test-info test-simple-info))
- (incf (test-info-assert-count test-info))
+ (cl-incf (test-info-assert-count test-info))
(if actual
(let* ((fail-message
(if fail-message
@@ -262,17 +264,19 @@ additional message to be displayed."
(if (boundp 'test-simple-info)
(test-info-description test-simple-info)
"unset")))
- (add-failure "assert-nil" test-info-mess fail-message test-info))
- (ok-msg fail-message)))
+ (test-simple--add-failure "assert-nil" test-info-mess
+ fail-message test-info))
+ (test-simple--ok-msg fail-message)))
-(defun add-failure(type test-info-msg fail-msg &optional test-info)
+(defun test-simple--add-failure (type test-info-msg fail-msg
+ &optional test-info)
(unless test-info (setq test-info test-simple-info))
- (incf (test-info-failure-count test-info))
+ (cl-incf (test-info-failure-count test-info))
(let ((failure-msg
(format "\nDescription: %s, type %s\n%s" test-info-msg type fail-msg))
)
(save-excursion
- (not-ok-msg)
+ (test-simple--not-ok-msg fail-msg)
(test-simple-msg failure-msg 't)
(unless noninteractive
(if test-simple-debug-on-error
@@ -281,7 +285,7 @@ additional message to be displayed."
)))))
(defun end-tests (&optional test-info)
- "Give a tally of the tests run"
+ "Give a tally of the tests run."
(interactive)
(unless test-info (setq test-info test-simple-info))
(test-simple-describe-failures test-info)
@@ -299,15 +303,13 @@ additional message to be displayed."
(defun test-simple-msg(msg &optional newline)
(switch-to-buffer "*test-simple*")
- (let ((old-read-only inhibit-read-only))
- (setq inhibit-read-only 't)
+ (let ((inhibit-read-only t))
(insert msg)
(if newline (insert "\n"))
- (setq inhibit-read-only old-read-only)
(switch-to-buffer nil)
))
-(defun ok-msg(fail-message &optional test-info)
+(defun test-simple--ok-msg (fail-message &optional test-info)
(unless test-info (setq test-info test-simple-info))
(let ((msg (if (getenv "USE_TAP")
(if (equal fail-message "")
@@ -319,7 +321,7 @@ additional message to be displayed."
(test-simple-msg msg))
't)
-(defun not-ok-msg(&optional test-info)
+(defun test-simple--not-ok-msg (_fail-message &optional test-info)
(unless test-info (setq test-info test-simple-info))
(let ((msg (if (getenv "USE_TAP")
(format "not ok %d\n" (test-info-assert-count test-info))
diff --git a/test/test-basic.el b/test/test-basic.el
index f14a385..723779a 100644
--- a/test/test-basic.el
+++ b/test/test-basic.el
@@ -22,7 +22,7 @@
(assert-t (memq 'test-simple features) "'test-simple provided")
(assert-nil nil "assert-nil failure test")
-(assert-nil nil "Knights if ni")
+(assert-nil nil "Knights of ni")
(assert-equal 5 (+ 1 4) "assert-equal")
(assert-raises error (error "you should not see this") "assert-raises")
- [elpa] master d857417 04/26: Merge pull request #8 from rubikitch/rename-test-filename, (continued)
- [elpa] master d857417 04/26: Merge pull request #8 from rubikitch/rename-test-filename, Rocky Bernstein, 2017/05/25
- [elpa] master 536ce2f 14/26: Remove unused lexical variables noted in byte compilation, Rocky Bernstein, 2017/05/25
- [elpa] master c7987a6 07/26: Emacs exits abnormally when noninteractive test fails., Rocky Bernstein, 2017/05/25
- [elpa] master d9abe19 08/26: gcd-tests.el: Add test-simple-run comment line, Rocky Bernstein, 2017/05/25
- [elpa] master a8bd341 22/26: Merge pull request #11 from doomvox/tap_stdout, Rocky Bernstein, 2017/05/25
- [elpa] master 6fd325b 17/26: Merge pull request #10 from syohex/switch-to-cask, Rocky Bernstein, 2017/05/25
- [elpa] master 611bd94 16/26: Switch from Carton to Cask, Rocky Bernstein, 2017/05/25
- [elpa] master e199434 20/26: Minor changes, Rocky Bernstein, 2017/05/25
- [elpa] master 8204b89 10/26: .travis.yml: Drop support of Emacs23 (Test in Emacs24), Rocky Bernstein, 2017/05/25
- [elpa] master 35ef95d 09/26: Mention test-simple-run in README.md, Rocky Bernstein, 2017/05/25
- [elpa] master 613fe8b 19/26: Version 1.2.0 sync with elpa,
Rocky Bernstein <=
- [elpa] master 604942d 24/26: Merge pull request #12 from syohex/cl-lib, Rocky Bernstein, 2017/05/25
- [elpa] master a2383c7 26/26: Bump version .., Rocky Bernstein, 2017/05/25
- [elpa] master e18adb1 25/26: Merge commit '604942d36021a8b14877a0a640234a09c79e0927', Rocky Bernstein, 2017/05/25
- [elpa] master 187808a 21/26: TAP output in batch mode now goes to stdout, not stderr, Rocky Bernstein, 2017/05/25
- [elpa] master 0d2969f 23/26: Use cl-lib instead of cl.el, Rocky Bernstein, 2017/05/25
- [elpa] master e904e38 12/26: Mention M-x test-simple-run in README.md, Rocky Bernstein, 2017/05/25
- [elpa] master 4c40e8d 15/26: A spelling typo, Rocky Bernstein, 2017/05/25
- [elpa] master 3056b86 13/26: Merge pull request #9 from rubikitch/test-runner, Rocky Bernstein, 2017/05/25
- [elpa] master 95e58b5 18/26: Why didn't I do this before?!, Rocky Bernstein, 2017/05/25