emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 9afba2e 17/17: Merge commit '8280df5ce6db836559a5c2442b97a


From: Rocky Bernstein
Subject: [elpa] master 9afba2e 17/17: Merge commit '8280df5ce6db836559a5c2442b97a2f02b6f7a05'
Date: Thu, 25 May 2017 02:05:05 -0400 (EDT)

branch: master
commit 9afba2e24277758be5861d4c4a1d885b82cf1ea2
Merge: 1e533d2 8280df5
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Merge commit '8280df5ce6db836559a5c2442b97a2f02b6f7a05'
---
 packages/load-relative/.gitignore                  |   1 +
 packages/load-relative/.travis.yml                 |   2 +-
 packages/load-relative/Makefile.am                 |   4 +-
 packages/load-relative/README.md                   |   4 +-
 packages/load-relative/load-relative.el            |   9 +-
 packages/load-relative/test/Makefile.am            |  12 +-
 packages/load-relative/test/install-pkgs.el        |  24 --
 .../load-relative/{ => test}/make-check-filter.rb  |   0
 packages/load-relative/test/simple-test.el         | 386 +++++++++++++++++++++
 packages/load-relative/test/test-load.el           |   4 +-
 packages/load-relative/test/test-require-list.el   |   4 +-
 11 files changed, 406 insertions(+), 44 deletions(-)

diff --git a/packages/load-relative/.gitignore 
b/packages/load-relative/.gitignore
index 61da6af..98b3aa5 100644
--- a/packages/load-relative/.gitignore
+++ b/packages/load-relative/.gitignore
@@ -2,6 +2,7 @@
 /*~
 /Makefile
 /Makefile.in
+/README
 /aclocal.m4
 /autom4te.cache
 /config.log
diff --git a/packages/load-relative/.travis.yml 
b/packages/load-relative/.travis.yml
index bc22a2f..56d6285 100644
--- a/packages/load-relative/.travis.yml
+++ b/packages/load-relative/.travis.yml
@@ -14,4 +14,4 @@ env:
 
 # run the tests
 script:
-  - /bin/bash ./autogen.sh && cd test && make check-elget
+  - /bin/bash ./autogen.sh && cd test && make check
diff --git a/packages/load-relative/Makefile.am 
b/packages/load-relative/Makefile.am
index 04aca09..5706b3b 100644
--- a/packages/load-relative/Makefile.am
+++ b/packages/load-relative/Makefile.am
@@ -3,7 +3,7 @@ lisp_LISP = $(lisp_files)
 
 PHONY=check check-short clean dist distclean test
 
-EXTRA_DIST = $(lisp_files) $(test_files) README.md THANKS COPYING
+EXTRA_DIST = $(lisp_files) $(test_files) README.md
 GIT2CL ?= git2cl
 
 #: Run all tests
@@ -12,7 +12,7 @@ check: $(test-files)
 
 #: Run all tests with minimum verbosity
 check-short:
-       $(MAKE) -C test check 2>&1  | ruby make-check-filter.rb
+       $(MAKE) -C test check 2>&1  | ruby test/make-check-filter.rb
 
 
 #: same as check
diff --git a/packages/load-relative/README.md b/packages/load-relative/README.md
index 563db03..c250d4e 100644
--- a/packages/load-relative/README.md
+++ b/packages/load-relative/README.md
@@ -5,7 +5,7 @@
 The rational behind module is to be able to write small Emacs
 functions or modules in a larger multi-file Emacs package and
 facilitate running from the source tree without having to "install"
-the code or fiddle with evil *load-path*'s . See my [NYC Lisp 
talk](https://github.com/rocky/emacs-load-relative/wiki/NYC-Lisp-talk) for more 
background on this.
+the code or fiddle with evil *load-path*'s. See my [NYC Lisp 
talk](https://github.com/rocky/emacs-load-relative/wiki/NYC-Lisp-talk) for more 
background on this.
 
 
 ## Contents ##
@@ -84,7 +84,7 @@ extension) as the name of the thing you want to provide. 
Using this
 forces the *provide* names to be the same as the filename, but I
 consider that a good thing.
 
-*provide-me* also takes an optional string which will be prepended to the 
provide name. This is useful if you have a multi-file package and want the 
files to bue prefaced with the name of the package.
+*provide-me* also takes an optional string which will be prepended to the 
provide name. This is useful if you have a multi-file package and want the 
files to be prefaced with the name of the package.
 
 Assume your package *foo* and contains simply file `foo.el`. Then
 adding:
diff --git a/packages/load-relative/load-relative.el 
b/packages/load-relative/load-relative.el
index 0605f17..155ba40 100644
--- a/packages/load-relative/load-relative.el
+++ b/packages/load-relative/load-relative.el
@@ -6,7 +6,7 @@
 ;; URL: http://github.com/rocky/emacs-load-relative
 ;; Compatibility: GNU Emacs 23.x
 
-;; Copyright (C) 2015 Free Software Foundation, Inc
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc
 
 ;; This program is free software: you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as
@@ -102,7 +102,6 @@
 ;; This is easier if you care about the contents of the file, rather than
 ;; a buffer.
 
-
 ;;; Code:
 
 ;;;###autoload
@@ -134,8 +133,8 @@ methods work we will use the file-name value find via
   ;; persists after loading or evaluating a file. So it would be
   ;; suitable if __FILE__ were called from inside a function.
 
-
   (cond
+
    ;; lread.c's readevalloop sets (car current-load-list)
    ;; via macro LOADHIST_ATTACH of lisp.h. At least in Emacs
    ;; 23.0.91 and this code goes back to '93.
@@ -161,8 +160,8 @@ methods work we will use the file-name value find via
    ;; FIXME: `bytecomp-filename' doesn't exist any more (since Emacs-24.1).
    ((boundp 'bytecomp-filename) bytecomp-filename)
 
-   (t (symbol-file symbol)) ;; last resort
-   ))
+   (t (symbol-file symbol) ;; last resort
+      )))
 
 (defun autoload-relative (function-or-list
                           file &optional docstring interactive type
diff --git a/packages/load-relative/test/Makefile.am 
b/packages/load-relative/test/Makefile.am
index 80518c2..867723c 100644
--- a/packages/load-relative/test/Makefile.am
+++ b/packages/load-relative/test/Makefile.am
@@ -2,6 +2,9 @@ include $(top_srcdir)/common.mk
 
 PHONY=check test all check-elget test-elget help
 
+#: same thing as check
+all: check
+
 #: overall help on running the make targets
 help:
        @echo "The main function of this Makefile is to facilitate running 
tests."
@@ -43,24 +46,21 @@ check: $(CHECK_FILES)
 #: Run all tests via el-get
 check-elget:
        (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash 
--load ./install-pkgs.el --load test-load.el)
-# Leave out until we can get dependecies worked out
-# #: Run all tests via el-get
-#check-elget: $(EL_GET_CHECK_FILES)s
 
 #: Run all tests with minimum verbosity
 check-short:
-       $(MAKE) check 2>&1  | ruby ../make-check-filter.rb
+       $(MAKE) check 2>&1  | ruby ./make-check-filter.rb
 
 #: Run all tests with minimum verbosity via el-get
 check-short-elget:
-       $(MAKE) check-elget 2>&1  | ruby ../make-check-filter.rb
+       $(MAKE) check-elget 2>&1  | ruby ./make-check-filter.rb
 
 test-%.run:
        (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash 
--load $(@:.run=.el))
 
 #: Run tests getting external Lisp dependencies
 test-%.elrun:
-       (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash 
--load ./install-pkgs.el --load $(@:.elrun=.el))
+       (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash 
--load ../el-get-install.el --load $(@:.elrun=.el))
 
 # Whatever it is you want to do, it should be forwarded to the
 # to top-level directories
diff --git a/packages/load-relative/test/install-pkgs.el 
b/packages/load-relative/test/install-pkgs.el
deleted file mode 100644
index d43575c..0000000
--- a/packages/load-relative/test/install-pkgs.el
+++ /dev/null
@@ -1,24 +0,0 @@
-;; Copyright (C) 2015 Free Software Foundation, Inc
-
-;; Author: Rocky Bernstein <address@hidden>
-
-;; This program 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.
-
-;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
-
-(require 'package)
-(package-refresh-contents)
-(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/";)))
-(condition-case nil
-    (package-install 'test-simple)
-  ((debug error) nil))
-(load-library "test-simple")
diff --git a/packages/load-relative/make-check-filter.rb 
b/packages/load-relative/test/make-check-filter.rb
similarity index 100%
rename from packages/load-relative/make-check-filter.rb
rename to packages/load-relative/test/make-check-filter.rb
diff --git a/packages/load-relative/test/simple-test.el 
b/packages/load-relative/test/simple-test.el
new file mode 100644
index 0000000..408be8e
--- /dev/null
+++ b/packages/load-relative/test/simple-test.el
@@ -0,0 +1,386 @@
+;;; 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, 2016 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+;; URL: http://github.com/rocky/emacs-test-simple
+;; Keywords: unit-test
+;; Package-Requires: ((cl-lib "0"))
+;; Version: 1.2.0
+
+;; This program 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.
+
+;; This program 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 this program.  If not, see
+;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; test-simple.el is:
+;;
+;; * Simple.  No need for
+;;   - context macros,
+;;   - enclosing specifications,
+;;   - required test tags.
+;;
+;;   But if you want, you still can enclose tests in a local scope,
+;;   add customized assert failure messages, or add summary messages
+;;   before a group of tests.
+;;
+;; * 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.
+;;    -  For non-interactive use, run:
+;;        emacs --batch --no-site-file --no-splash --load <test-lisp-code.el>
+;;
+;; Here is an example using gcd.el found in the examples directory.
+;;
+;;   (require 'test-simple)
+;;   (test-simple-start) ;; Zero counters and start the stop watch.
+;;
+;;   ;; Use (load-file) below because we want to always to read the source.
+;;   ;; Also, we don't want no stinking compiled source.
+;;   (assert-t (load-file "./gcd.el")
+;;           "Can't load gcd.el - are you in the right directory?" )
+;;
+;;   (note "degenerate cases")
+;;
+;;   (assert-nil (gcd 5 -1) "using positive numbers")
+;;   (assert-nil (gcd -4 1) "using positive numbers, switched order")
+;;   (assert-raises error (gcd "a" 32)
+;;                  "Passing a string value should raise an error")
+;;
+;;   (note "GCD computations")
+;;   (assert-equal 1 (gcd 3 5) "gcd(3,5)")
+;;   (assert-equal 8 (gcd 8 32) "gcd(8,32)")
+;;   (end-tests) ;; Stop the clock and print a summary
+;;
+;; Edit (with Emacs of course) gcd-tests.el and run M-x eval-current-buffer
+;;
+;; You should see in buffer *test-simple*:
+;;
+;;    gcd-tests.el
+;;    ......
+;;    0 failures in 6 assertions (0.002646 seconds)
+;;
+;; Now let us try from a command line:
+;;
+;;    $ emacs --batch --no-site-file --no-splash --load gcd-tests.el
+;;    Loading /src/external-vcs/emacs-test-simple/example/gcd.el (source)...
+;;    *scratch*
+;;    ......
+;;    0 failures in 6 assertions (0.000723 seconds)
+
+;;; To do:
+
+;; FIXME: Namespace is all messed up!
+;; Main issues: more expect predicates
+
+(require 'time-date)
+
+;;; Code:
+
+(eval-when-compile
+  (byte-compile-disable-warning 'cl-functions)
+  ;; Somehow disabling cl-functions causes the erroneous message:
+  ;;   Warning: the function `reduce' might not be defined at runtime.
+  ;; FIXME: isolate, fix and/or report back to Emacs developers a bug
+  ;; (byte-compile-disable-warning 'unresolved)
+  (require 'cl)
+  )
+(require 'cl)
+
+(defgroup test-simple nil
+  "Simple Unit Test Framework for Emacs Lisp"
+  :group 'lisp)
+
+(defcustom test-simple-runner-interface (if (fboundp 'bpr-spawn)
+                                            'bpr-spawn
+                                          'compile)
+  "Function with one string argument when running tests non-interactively.
+Command line started with `emacs --batch' is passed as the argument.
+
+`bpr-spawn', which is in bpr package, is preferable because of no window popup.
+If bpr is not installed, fall back to `compile'."
+  :type 'function
+  :group 'test-simple)
+
+(defcustom test-simple-runner-key "C-x C-z"
+  "Key to run non-interactive test after defining command line by 
`test-simple-run'."
+  :type 'string
+  :group 'test-simple)
+
+(defvar test-simple-debug-on-error nil
+  "If non-nil raise an error on the first failure.")
+
+(defvar test-simple-verbosity 0
+  "The greater the number the more verbose output.")
+
+(defstruct test-info
+  description                 ;; description of last group of tests
+  (assert-count 0)            ;; total number of assertions run
+  (failure-count 0)           ;; total number of failures seen
+  (start-time (current-time)) ;; Time run started
+  )
+
+(defvar test-simple-info (make-test-info)
+  "Variable to store testing information for a buffer.")
+
+(defun note (description &optional test-info)
+  "Add a name to a group of tests."
+  (if (getenv "USE_TAP")
+    (test-simple-msg (format "# %s" description) 't)
+    (if (> test-simple-verbosity 0)
+       (test-simple-msg (concat "\n" description) 't))
+    (unless test-info
+      (setq test-info test-simple-info))
+    (setf (test-info-description test-info) description)
+    ))
+
+;;;###autoload
+(defmacro test-simple-start (&optional test-start-msg)
+  `(test-simple-clear nil
+                     (or ,test-start-msg
+                         (if (and (functionp '__FILE__) (__FILE__))
+                             (file-name-nondirectory (__FILE__))
+                           (buffer-name)))
+                     ))
+
+;;;###autoload
+(defun test-simple-clear (&optional test-info test-start-msg)
+  "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)
+
+  (unless test-info
+    (unless test-simple-info
+      (make-variable-buffer-local (defvar test-simple-info (make-test-info))))
+    (setq test-info test-simple-info))
+
+  (setf (test-info-description test-info) "none set")
+  (setf (test-info-start-time test-info) (current-time))
+  (setf (test-info-assert-count test-info) 0)
+  (setf (test-info-failure-count test-info) 0)
+
+  (with-current-buffer (get-buffer-create "*test-simple*")
+    (let ((old-read-only inhibit-read-only))
+      (setq inhibit-read-only 't)
+      (delete-region (point-min) (point-max))
+      (if test-start-msg (insert (format "%s\n" test-start-msg)))
+      (setq inhibit-read-only old-read-only)))
+  (unless noninteractive
+    (message "Test-Simple: test information cleared")))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Assertion tests
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defmacro assert-raises (error-condition body &optional fail-message)
+  (let ((fail-message (or fail-message
+                         (format "assert-raises did not get expected %s"
+                                 error-condition))))
+    (list 'condition-case nil
+         (list 'progn body
+               (list 'assert-t nil fail-message))
+         (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."
+  (unless test-info (setq test-info test-simple-info))
+  (cl-incf (test-info-assert-count test-info))
+  (if (not (funcall op actual expected))
+      (let* ((fail-message
+             (if fail-message
+                 (format "Message: %s" fail-message)
+               ""))
+            (expect-message
+             (format "\n  Expected: %S\n  Got: %S" expected actual))
+            (test-info-mess
+             (if (boundp 'test-info)
+                 (test-info-description test-info)
+               "unset")))
+       (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."
+  (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."
+  (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."
+  (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."
+  (unless test-info (setq test-info test-simple-info))
+  (cl-incf (test-info-assert-count test-info))
+  (if (not (string-match expected-regexp actual))
+      (let* ((fail-message
+             (if fail-message
+                 (format "\n\tMessage: %s" fail-message)
+               ""))
+            (expect-message
+             (format "\tExpected Regexp: %s\n\tGot:      %s"
+                     expected-regexp actual))
+            (test-info-mess
+             (if (boundp 'test-info)
+                 (test-info-description test-info)
+               "unset")))
+       (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)
+  "expectation is that ACTUAL is not nil."
+  (assert-nil (not actual) fail-message test-info))
+
+(defun assert-nil (actual &optional fail-message test-info)
+  "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))
+  (cl-incf (test-info-assert-count test-info))
+  (if actual
+      (let* ((fail-message
+             (if fail-message
+                 (format "\n\tMessage: %s" fail-message)
+               ""))
+            (test-info-mess
+             (if (boundp 'test-simple-info)
+                 (test-info-description test-simple-info)
+               "unset")))
+       (test-simple--add-failure "assert-nil" test-info-mess
+                                  fail-message test-info))
+    (test-simple--ok-msg fail-message)))
+
+(defun test-simple--add-failure (type test-info-msg fail-msg
+                                      &optional test-info)
+  (unless test-info (setq test-info test-simple-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
+      (test-simple--not-ok-msg fail-msg)
+      (test-simple-msg failure-msg 't)
+      (unless noninteractive
+       (if test-simple-debug-on-error
+           (signal 'test-simple-assert-failed failure-msg)
+         ;;(message failure-msg)
+         )))))
+
+(defun end-tests (&optional test-info)
+  "Give a tally of the tests run."
+  (interactive)
+  (unless test-info (setq test-info test-simple-info))
+  (test-simple-describe-failures test-info)
+  (if noninteractive
+      (progn
+       (switch-to-buffer "*test-simple*")
+       (message "%s" (buffer-substring (point-min) (point-max)))
+       )
+    (switch-to-buffer-other-window "*test-simple*")
+    ))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Reporting
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun test-simple-msg(msg &optional newline)
+  (switch-to-buffer "*test-simple*")
+  (let ((inhibit-read-only t))
+    (insert msg)
+    (if newline (insert "\n"))
+    (switch-to-buffer nil)
+  ))
+
+(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 "")
+                    (format "ok %d\n" (test-info-assert-count test-info))
+                  (format "ok %d - %s\n"
+                          (test-info-assert-count test-info)
+                          fail-message))
+              ".")))
+      (test-simple-msg msg))
+  't)
+
+(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))
+              "F")))
+      (test-simple-msg msg))
+  nil)
+
+(defun test-simple-summary-line(info)
+  (let*
+      ((failures (test-info-failure-count info))
+       (asserts (test-info-assert-count info))
+       (problems (concat (number-to-string failures) " failure"
+                        (unless (= 1 failures) "s")))
+       (tests (concat (number-to-string asserts) " assertion"
+                     (unless (= 1 asserts) "s")))
+       (elapsed-time (time-since (test-info-start-time info)))
+       )
+    (if (getenv "USE_TAP")
+       (format "1..%d" asserts)
+      (format "\n%s in %s (%g seconds)" problems tests
+             (float-time elapsed-time))
+  )))
+
+(defun test-simple-describe-failures(&optional test-info)
+  (unless test-info (setq test-info test-simple-info))
+  (goto-char (point-max))
+  (test-simple-msg (test-simple-summary-line test-info)))
+
+;;;###autoload
+(defun test-simple-run (&rest command-line-formats)
+  "Register command line to run tests non-interactively and bind key to run 
test.
+After calling this function, you can run test by key specified by 
`test-simple-runner-key'.
+
+It is preferable to write at the first line of test files as a comment, e.g,
+;;;; (test-simple-run \"emacs -batch -L %s -l %s\" (file-name-directory 
(locate-library \"test-simple.elc\")) buffer-file-name)
+
+Calling this function interactively, COMMAND-LINE-FORMATS is set above."
+  (interactive)
+  (setq command-line-formats
+        (or command-line-formats
+            (list "emacs -batch -L %s -l %s"
+                  (file-name-directory (locate-library "test-simple.elc"))
+                  buffer-file-name)))
+  (let ((func (lambda ()
+                (interactive)
+                (funcall test-simple-runner-interface
+                         (apply 'format command-line-formats)))))
+    (global-set-key (kbd test-simple-runner-key) func)
+    (funcall func)))
+
+(defun test-simple-noninteractive-kill-emacs-hook ()
+  "Emacs exits abnormally when noninteractive test fails."
+  (when (and noninteractive test-simple-info
+             (<= 1 (test-info-failure-count test-simple-info)))
+    (let (kill-emacs-hook)
+     (kill-emacs 1))))
+(when noninteractive
+  (add-hook 'kill-emacs-hook 'test-simple-noninteractive-kill-emacs-hook))
+
+
+(provide 'test-simple)
+;;; test-simple.el ends here
diff --git a/packages/load-relative/test/test-load.el 
b/packages/load-relative/test/test-load.el
index af47412..1002996 100644
--- a/packages/load-relative/test/test-load.el
+++ b/packages/load-relative/test/test-load.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015 Free Software Foundation, Inc
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -15,7 +15,7 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 (require 'cl)
-(require 'test-simple)
+(load-file "./simple-test.el")
 (load-file "../load-relative.el")
 
 (test-simple-start)
diff --git a/packages/load-relative/test/test-require-list.el 
b/packages/load-relative/test/test-require-list.el
index fae8421..a64c346 100644
--- a/packages/load-relative/test/test-require-list.el
+++ b/packages/load-relative/test/test-require-list.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2015 Free Software Foundation, Inc
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc
 
 ;; Author: Rocky Bernstein <address@hidden>
 
@@ -15,7 +15,7 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 (require 'cl)
-(require 'test-simple)
+(load-file "./simple-test.el")
 (load-file "../load-relative.el")
 
 (test-simple-start)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]