branch: externals/loc-changes
commit 0a55bcba684f78417e831eef2cc32da24a207f29
Author: rocky <ro...@gnu.org>
Commit: rocky <ro...@gnu.org>

    Try to get TravisCI working
---
 Cask               |  7 +++++++
 cask-install.el    | 13 +++++++++++++
 run-travis-ci.sh   |  3 ++-
 test/Makefile.am   | 22 ++++++++++++++++++++--
 test/test-basic.el | 15 +++++----------
 5 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/Cask b/Cask
new file mode 100644
index 0000000000..1f20105fd0
--- /dev/null
+++ b/Cask
@@ -0,0 +1,7 @@
+(package-file "loc-changes.el")
+
+(source gnu)
+(source melpa)
+
+(development
+  (depends-on "test-simple"))
diff --git a/cask-install.el b/cask-install.el
new file mode 100644
index 0000000000..29de87fe8c
--- /dev/null
+++ b/cask-install.el
@@ -0,0 +1,13 @@
+(require 'cask "~/.cask/cask.el")
+(let*
+    ((parent-dir
+      (if (string-match "test/$" default-directory)
+       (file-name-directory (directory-file-name default-directory))
+      default-directory)))
+  (cask-initialize parent-dir))
+;; There is a bug on Travis where we are getting
+;; "Symbol’s function definition is void: make-mutex"
+;; We'll work around it here
+(if (not (functionp 'make-mutex))
+    (defun make-mutex(&optional name)))
+(require 'test-simple)
diff --git a/run-travis-ci.sh b/run-travis-ci.sh
index b68dda79d3..a17b3f9ef8 100755
--- a/run-travis-ci.sh
+++ b/run-travis-ci.sh
@@ -17,4 +17,5 @@ echo "EMACS =" $(which $EMACS)
 $EMACS --version
 echo
 
-NO_CHECK_EMACS_PACKAGES=1 /bin/bash ./autogen.sh && cd test && make check
+cask
+NO_CHECK_EMACS_PACKAGES=1 /bin/bash ./autogen.sh && cd test && make check-cask
diff --git a/test/Makefile.am b/test/Makefile.am
index 2d6a227b71..466cb0eedb 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,12 +1,28 @@
 include $(top_srcdir)/common.mk
 
+lisp_files = $(wildcard *.el)
+lisp_LISP = $(lisp_files)
+EXTRA_DIST = $(lisp_files)
+
 PHONY=check test all check-elget test-elget help
 
+test_files := $(wildcard test-*.el)
+
+CHECK_FILES = $(notdir $(test_files:.el=.run))
+
 all: check
 
 #: same thing as "check"
 test: check
 
+#: same thing as "check-elget"
+test-cask: check-cask
+
+EL_GET_CHECK_FILES = $(notdir $(test_files:.el=.elrun))
+
+#: Run all tests via cask
+check-cask: $(EL_GET_CHECK_FILES)
+
 #: overall help on running the make targets
 help:
        @echo "The main function of this Makefile is to facilitate running 
tests."
@@ -62,9 +78,11 @@ check-short-elget:
 test-%.run:
        (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash 
--load $(@:.run=.el))
 
-#: Run tests using el-get to specify external Lisp dependencies
+#: Run tests using cask to specify external Lisp dependencies
 test-%.elrun:
-       (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash 
--load ../el-get-install.el --load $(@:.elrun=.el))
+       (cd $(top_srcdir)/test && $(EMACS) --batch --no-site-file --no-splash 
--load ../cask-install.el --load $(@:.elrun=.el))
+
+install-lispLISP: $(lisp_LISP) $(ELCFILES)
 
 # Whatever it is you want to do, it should be forwarded to the
 # to top-level directories
diff --git a/test/test-basic.el b/test/test-basic.el
index 190d1dd324..a4a6447a3c 100644
--- a/test/test-basic.el
+++ b/test/test-basic.el
@@ -31,8 +31,7 @@
 (assert-raises error (loc-changes-goto-line 10000))
 
 (note "loc-changes-goto-line")
-(save-excursion
-  (set-buffer sample-buffer)
+(with-current-buffer sample-buffer
   (loc-changes-goto-line 5)
   (assert-equal 5 (line-number-at-pos (point))))
 
@@ -46,8 +45,7 @@
   )
 
 (note "loc-changes-goto-line-invalid-column")
-(save-excursion
-  (set-buffer sample-buffer)
+(with-current-buffer sample-buffer
   (loc-changes-goto-line 1 300)
   (assert-equal 1 (line-number-at-pos (point)))
   ;; FIXME
@@ -69,8 +67,7 @@
 (assert-equal '() loc-changes-alist)
 
 (note "loc-changes-add-and-goto - update")
-(save-excursion
-  (set-buffer sample-buffer)
+(with-current-buffer sample-buffer
   (loc-changes-add-and-goto 10)
   (assert-equal 10 (line-number-at-pos)
                "point should be at line 10")
@@ -82,8 +79,7 @@
   )
 
 (note "loc-changes-goto - update")
-(save-excursion
-  (set-buffer sample-buffer)
+(with-current-buffer sample-buffer
   (loc-changes-goto 11)
   (assert-equal 11 (line-number-at-pos)
                "point should be at line 11")
@@ -95,8 +91,7 @@
   )
 
 (note "loc-changes-goto - no update")
-(save-excursion
-  (set-buffer sample-buffer)
+(with-current-buffer sample-buffer
   (loc-changes-goto 12 nil 't)
   (assert-equal 12 (line-number-at-pos)
                "point should be at line 12")

Reply via email to