branch: scratch/el-mock
commit c05cc24df68fd2e5a16a542b212c5f25b843da46
Merge: 01cf866b4b a843820161
Author: Robert Irelan <rire...@gmail.com>
Commit: GitHub <nore...@github.com>

    Merge pull request #30 from telotortium/fix-backtrace
    
    Update preserve-backtrace test for Emacs 26+
---
 test/el-mock-test.el | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/test/el-mock-test.el b/test/el-mock-test.el
index 16886b1eec..0d076c3478 100644
--- a/test/el-mock-test.el
+++ b/test/el-mock-test.el
@@ -389,8 +389,8 @@
  (expect (error mock-error '((foo 1) (foo)))
    (with-mock
      (mock (foo 1))
-     (foo)))
- )
+     (foo))))
+ 
 
 (defun el-mock-test--signal ()
   (error "Foo"))
@@ -406,5 +406,17 @@
     (should (ert-test-failed-p result))
     (should (equal (ert-test-failed-condition result)
                    '(error "Foo")))
-    (should (equal (car-safe (ert-test-failed-backtrace result))
-                   '(t el-mock-test--signal)))))
+    (cond
+     ((version< emacs-version "26")
+      (should (equal
+               (nth 0 (ert-test-failed-backtrace result))
+               '(t el-mock-test--signal))))
+     ((version< emacs-version "27")
+      (should (equal
+               (nth 2 (ert-test-failed-backtrace result))
+               '(t el-mock-test--signal nil nil))))
+     (t
+      (should (equal
+               (nth 2 (ert-test-failed-backtrace result))
+               (record 'backtrace-frame t 'el-mock-test--signal
+                       nil nil nil nil nil)))))))

Reply via email to