[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 1bb0ba9439 8/9: Merge PR 219 into byte-compiled
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 1bb0ba9439 8/9: Merge PR 219 into byte-compiled |
Date: |
Wed, 10 Aug 2022 18:58:14 -0400 (EDT) |
branch: elpa/buttercup
commit 1bb0ba9439a25f3ff543795233b489e3f1ea55c0
Merge: cdbb8b061d ef293a62df
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
Merge PR 219 into byte-compiled
* commit 'ef293a6':
Fix: (buttercup--enclosed-expr) byte-code functions
Removed the special error case for byte compiled functions as it broke
pcase on Emacs 24.4 and all the other special errors were already
removed.
---
buttercup.el | 10 +++++++++-
tests/test-buttercup.el | 13 +++++++++----
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/buttercup.el b/buttercup.el
index 1fdfc74b5b..bf7f265162 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -57,7 +57,8 @@
(defun buttercup--enclosed-expr (fun)
"Given a zero-arg function FUN, return its unevaluated expression.
-The function MUST have one of the following forms:
+The function MUST be byte-compiled or have one of the following
+forms:
\(closure (ENVLIST) () (quote EXPR) (buttercup--mark-stackframe) EXPANDED)
\(lambda () (quote EXPR) (buttercup--mark-stackframe) EXPR)
@@ -88,6 +89,13 @@ ensures access to the un-expanded form."
(quote ,expr) (buttercup--mark-stackframe) ,expr2)
(guard (equal expr expr2)))
expr)
+ ;;; This is when FUN has been byte compiled, as when the entire
+ ;;; test file has been byte compiled. Check that it has an empty
+ ;;; arglist, that is all that is possible at this point. The
+ ;;; return value is byte compiled code, not the original
+ ;;; expressions. Also what is possible at this point.
+ ((and (pred byte-code-function-p) (guard (member (aref fun 0) '(nil 0))))
+ (aref fun 1))
;; Error
(_ (error "Not a zero-arg one-expression closure: %S" fun))))
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index ea3da31ded..292b21d3cd 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -26,6 +26,7 @@
(require 'buttercup)
(require 'autoload)
(require 'ansi-color)
+(require 'bytecomp)
(require 'ert)
(require 'ert-x)
(require 'cl-lib)
@@ -142,7 +143,7 @@ text properties using `ansi-color-apply'."
;;; helpers
(describe "The buttercup--enclosed-expr function"
- (describe "should handle"
+ (describe "should handle"
(it "expressions wrapped by buttercup--wrap-expr"
(expect (buttercup--enclosed-expr (buttercup--wrap-expr '(ignore)))
:to-equal '(ignore)))
@@ -157,13 +158,13 @@ text properties using `ansi-color-apply'."
(expect (buttercup--enclosed-expr
'(lambda () (quote (ignore)) (buttercup--mark-stackframe)
(ignore))))
:to-equal '(ignore))
- (xdescribe "byte compiled"
+ (describe "byte compiled"
(it "lambda objects"
(expect (buttercup--enclosed-expr
(byte-compile-sexp '(lambda () '(ignore)
(buttercup--mark-stackframe) (ignore))))))
(it "wrapped expression"
(expect (buttercup--enclosed-expr (byte-compile-sexp
(buttercup--wrap-expr '(ignore))))))))
- (describe "should error"
+ (describe "should error"
(it "on a simple closure"
(expect
(buttercup--enclosed-expr (let ((_foo 1)) (lambda () (ignore))))
@@ -207,7 +208,11 @@ text properties using `ansi-color-apply'."
(expect (buttercup--enclosed-expr
'(lambda (foo) (ignore foo)))
:to-throw
- 'error '("Not a zero-arg one-expression closure: (lambda (foo)
(ignore foo))")))))
+ 'error '("Not a zero-arg one-expression closure: (lambda (foo)
(ignore foo))")))
+ (it "on byte-compiled functions with arguments"
+ (expect (buttercup--enclosed-expr
+ (byte-compile-sexp '(lambda (_a) '(ignore)
(buttercup--mark-stackframe) (ignore))))
+ :to-throw 'error))))
;;;;;;;;;;
;;; expect
- [nongnu] elpa/buttercup updated (62176a39ee -> 497f6c2795), ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup ec4d94f7d5 3/9: tests: Create enclosed expressions with buttercup--wrap-expr, ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup ef293a62df 1/9: Fix: (buttercup--enclosed-expr) byte-code functions, ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup 8dda6ef8c9 2/9: Refactor the expect macro, ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup 1bb0ba9439 8/9: Merge PR 219 into byte-compiled,
ELPA Syncer <=
- [nongnu] elpa/buttercup 497f6c2795 9/9: Merge branch 'byte-compiled', ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup 4cbd106609 5/9: tests: Use buttercup--wrap-expr instead of make-list-of-closures, ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup 435fc0d378 4/9: tests: Fix some buttercup-expect tests, ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup 0e26b1bbed 6/9: Clean up buttercup--enclosed-expr, ELPA Syncer, 2022/08/10
- [nongnu] elpa/buttercup cdbb8b061d 7/9: tests: Add tests for buttercup--enclosed-expr, ELPA Syncer, 2022/08/10