]> code.delx.au - gnu-emacs/commitdiff
Work around the failures in icalendar-tests which occasionally occur
authorUlf Jasper <ulf.jasper@web.de>
Sat, 26 Jul 2014 12:53:36 +0000 (14:53 +0200)
committerUlf Jasper <ulf.jasper@web.de>
Sat, 26 Jul 2014 12:53:36 +0000 (14:53 +0200)
on hydra.nixos.org.

* automated/icalendar-tests.el (icalendar-tests--do-test-import):
Work around the failures in icalendar-tests which occasionally occur on
hydra.nixos.org.

test/ChangeLog
test/automated/icalendar-tests.el

index c66ea1c739f67e19e9dc00d69e3ff9a17267dda0..6afa9ea89593c0f5c914774a5346ba764adabca5 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-26  Ulf Jasper  <ulf.jasper@web.de>
+
+       * automated/icalendar-tests.el (icalendar-tests--do-test-import):
+       Work around the failures in icalendar-tests which occasionally occur on
+       hydra.nixos.org.
+
 2014-07-21  Fabián Ezequiel Gallina  <fgallina@gnu.org>
 
        * automated/python-tests.el:
index b921853c4aa06bf40a3a7f7dec281bcb703f868f..7b51f907d38c7de74d231c4a4067eafc99e5e8da 100644 (file)
@@ -718,11 +718,34 @@ Argument EXPECTED-AMERICAN expected american style diary string."
 Argument INPUT input icalendar string.
 Argument EXPECTED-OUTPUT expected diary string."
   (let ((temp-file (make-temp-file "icalendar-test-diary")))
+    ;; Test the Catch-the-mysterious-coding-header logic below.
+    ;; Ruby-mode adds an after-save-hook which inserts the header!
+    ;; (save-excursion
+    ;;   (find-file temp-file)
+    ;;   (ruby-mode))
     (icalendar-import-buffer temp-file t t)
     (save-excursion
       (find-file temp-file)
+      ;; Check for the mysterious "# coding: ..." header, remove it
+      ;; and give a shout
+      (goto-char (point-min))
+      (when (re-search-forward "# coding: .*?\n" nil t)
+        (message (concat "%s\n"
+                         "Found mysterious \"# coding ...\" header!  Removing it.\n"
+                         "Current Modes: %s, %s\n"
+                         "Current test: %s\n"
+                         "%s")
+                 (make-string 70 ?*)
+                 major-mode
+                 minor-mode-list
+                 (ert-running-test)
+                 (make-string 70 ?*))
+        (buffer-disable-undo)
+        (replace-match "")
+        (set-buffer-modified-p nil))
+
       (let ((result (buffer-substring-no-properties (point-min) (point-max))))
-       (should (string= expected-output result)))
+        (should (string= expected-output result)))
       (kill-buffer (find-buffer-visiting temp-file))
       (delete-file temp-file))))