[Top][All Lists]

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

[elpa] master cb4562e: Let ert-support.el work for subdirectories

From: Michael Albinus
Subject: [elpa] master cb4562e: Let ert-support.el work for subdirectories
Date: Wed, 18 Jan 2017 11:46:10 -0500 (EST)

branch: master
commit cb4562e5d076e590e2d4b9d50bece5d86372f54b
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Let ert-support.el work for subdirectories
    * admin/ert-support.el (all): Use `expand-file-name'.
    (ert-support-test-find-tests): Add autoload file.  Return absolute
    file names.  Do not return "." and ".." from subdirectories.
    (ert-support-load-tests): Let-bind `force-load-messages'.
 admin/ert-support.el | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/admin/ert-support.el b/admin/ert-support.el
index 93d1af8..a0ff9ab 100644
--- a/admin/ert-support.el
+++ b/admin/ert-support.el
@@ -1,6 +1,6 @@
 ;; The contents of this file are subject to the GPL License, Version 3.0.
-;; Copyright (C) 2016, Free Software Foundation, Inc.
+;; Copyright (C) 2016-2017, 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 published by
@@ -18,37 +18,38 @@
 (defun ert-support-package-install (top-directory package)
   ;; blitz default value and set up from elpa.
   (setq package-archives
-        `(("local-elpa" . ,(concat top-directory "/archive/packages"))))
-  (setq package-user-dir
-        (make-temp-file "elpa-test" t))
+        `(("local-elpa"
+          . ,(expand-file-name "archive/packages" top-directory)))
+       package-user-dir (make-temp-file "elpa-test" t))
   (package-install package))
 (defun ert-support-test-find-tests (package-directory package)
-  (or
-   (directory-files package-directory nil ".*-test.el$")
-   (directory-files package-directory nil ".*-tests.el$")
-   (let ((dir-test
-          (concat package-directory "/test")))
-     (when (file-exists-p dir-test)
-       (directory-files dir-test)))
-   (let ((dir-tests
-          (concat package-directory "/tests")))
-     (when (file-exists-p dir-tests)
-       (directory-files dir-tests)))))
+  (append
+   `(,(expand-file-name
+       (concat (symbol-name package) "-autoloads.el") package-directory))
+   (or
+    (directory-files package-directory t ".*-test.el$")
+    (directory-files package-directory t ".*-tests.el$")
+    (let ((dir-test (expand-file-name "test" package-directory)))
+      (when (file-directory-p dir-test)
+       (directory-files dir-test t directory-files-no-dot-files-regexp)))
+    (let ((dir-tests (expand-file-name "tests" package-directory)))
+      (when (file-directory-p dir-tests)
+       (directory-files dir-tests t directory-files-no-dot-files-regexp))))))
 (defun ert-support-load-tests (package-directory package)
-   (lambda(file)
-     (message "Loading test file... %s" (concat package-directory file))
-     (load-file (concat package-directory file)))
+   (lambda (file)
+     (let ((force-load-messages t))
+       (load-file file)))
    (ert-support-test-find-tests package-directory package)))
 (defun ert-support-test-package (top-directory package)
   (ert-support-package-install top-directory package)
-   (concat top-directory "/packages/" (symbol-name package) "/")
+   (expand-file-name (concat "packages/" (symbol-name package)) top-directory)
   (ert-run-tests-batch-and-exit t))

reply via email to

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