emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master e882e7a: Allow shr-tests to work for out-of-tree bu


From: Ken Brown
Subject: [Emacs-diffs] master e882e7a: Allow shr-tests to work for out-of-tree builds
Date: Tue, 24 May 2016 15:34:17 +0000 (UTC)

branch: master
commit e882e7a35673204397c295b6e92e66e3207a901e
Author: Ken Brown <address@hidden>
Commit: Ken Brown <address@hidden>

    Allow shr-tests to work for out-of-tree builds
    
    * test/lisp/net/shr-tests.el (shr-tests--datadir): New defconst.
    (shr-test, rendering): Use it.
---
 test/lisp/net/shr-tests.el |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index ab6fc93..501916f 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -25,9 +25,12 @@
 
 (require 'shr)
 
+(defconst shr-tests--datadir
+  (expand-file-name "test/data/shr" source-directory))
+
 (defun shr-test (name)
   (with-temp-buffer
-    (insert-file-contents (format "data/shr/%s.html" name))
+    (insert-file-contents (format (concat shr-tests--datadir "/%s.html") name))
     (let ((dom (libxml-parse-html-region (point-min) (point-max)))
           (shr-width 80)
           (shr-use-fonts nil))
@@ -35,7 +38,8 @@
       (shr-insert-document dom)
       (cons (buffer-substring-no-properties (point-min) (point-max))
             (with-temp-buffer
-              (insert-file-contents (format "data/shr/%s.txt" name))
+              (insert-file-contents
+               (format (concat shr-tests--datadir "/%s.txt") name))
               (while (re-search-forward "%\\([0-9A-F][0-9A-F]\\)" nil t)
                 (replace-match (string (string-to-number (match-string 1) 16))
                                t t))
@@ -43,7 +47,7 @@
 
 (ert-deftest rendering ()
   (skip-unless (fboundp 'libxml-parse-html-region))
-  (dolist (file (directory-files "data/shr" nil "\\.html\\'"))
+  (dolist (file (directory-files shr-tests--datadir nil "\\.html\\'"))
     (let* ((name (replace-regexp-in-string "\\.html\\'" "" file))
            (result (shr-test name)))
       (unless (equal (car result) (cdr result))



reply via email to

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