[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 6c3bb75 318/340: Accept a list of regexes in but
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 6c3bb75 318/340: Accept a list of regexes in buttercup-mark-skipped |
Date: |
Thu, 16 Dec 2021 14:59:58 -0500 (EST) |
branch: elpa/buttercup
commit 6c3bb75df026bca8d581471810ea18f9f4196b98
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: Ola Nilsson <ola.nilsson@gmail.com>
Accept a list of regexes in buttercup-mark-skipped
This means regexes are accepted on the command line --pattern option
again. --pattern was downgraded to substring matching in
41424d5fa0732c96cd54fdbbcb8800a6e6170f34.
Fixes #191.
---
bin/buttercup | 9 +++++----
bin/buttercup.bat | 6 +++++-
buttercup.el | 17 ++++++++++++-----
tests/test-buttercup.el | 6 ++++--
4 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/bin/buttercup b/bin/buttercup
index 8562905..601a8e0 100755
--- a/bin/buttercup
+++ b/bin/buttercup
@@ -29,10 +29,11 @@ Buttercup options:
--pattern, -p PATTERN Only run tests with names matching PATTERN.
This option can be used multiple times, in
which case tests will be run if they match
- any of the given patterns. PATTERN is
- matched as a substring of the full test
- description (the concatenation of the test
- and all paremt suites descriptions).
+ any of the given patterns. PATTERN should be
+ an Emacs regex that will be matched against
+ the full test description (the concatenation
+ of the test and all parent suites
+ descriptions).
--no-skip Do not print the descriptions for tests that
are filtered out with "--pattern" or disabled
diff --git a/bin/buttercup.bat b/bin/buttercup.bat
index eda7eca..edff81d 100644
--- a/bin/buttercup.bat
+++ b/bin/buttercup.bat
@@ -33,7 +33,11 @@ echo.
echo --pattern, -p PATTERN Only run tests with names matching PATTERN.
echo This option can be used multiple times, in
echo which case tests will be run if they match
-echo any of the given patterns.
+echo any of the given patterns. PATTERN should be
+echo an Emacs regex that will be matched against
+echo the full test description (the concatenation
+echo of the test and all parent suites
+echo descriptions).
echo.
echo --no-skip Do not print the descriptions for tests that
echo are filtered out with "--pattern" or disabled
diff --git a/buttercup.el b/buttercup.el
index df1aa72..af43685 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -1399,21 +1399,28 @@ current directory."
(when (not (string-match "\\(^\\|/\\)\\." (file-relative-name file)))
(load file nil t))))
(when patterns
- (buttercup-mark-skipped (regexp-opt patterns) t))
+ (buttercup-mark-skipped patterns t))
(buttercup-run)))
(defun buttercup-mark-skipped (matcher &optional reverse)
"Mark any spec that match MATCHER as skipped.
-MATCHER can be either a regex or a function taking a spec as the
-single argument. If REVERSE is non-nil, specs will be marked as
-pending when MATCHER does not match."
+MATCHER can be either a regex, a list of regexes, or a function
+taking a spec as the single argument. If REVERSE is non-nil,
+specs will be marked as pending when MATCHER does not match."
(cl-etypecase matcher
(string (buttercup--mark-skipped
buttercup-suites
(lambda (spec)
(string-match matcher (buttercup-spec-full-name spec)))
reverse))
- (function (buttercup--mark-skipped buttercup-suites matcher reverse))))
+ (function (buttercup--mark-skipped buttercup-suites matcher reverse))
+ (list (cond
+ ((cl-every #'stringp matcher)
+ (buttercup-mark-skipped (mapconcat (lambda (re)
+ (concat "\\(?:" re "\\)"))
+ matcher "\\|")
+ reverse))
+ (t (error "Bad matcher list: %s, should be list of strings"
matcher))))))
(defun buttercup--mark-skipped (suites predicate &optional reverse-predicate)
"Mark all specs in SUITES as skipped if PREDICATE(spec) is true.
diff --git a/tests/test-buttercup.el b/tests/test-buttercup.el
index b9fbf54..cdf493a 100644
--- a/tests/test-buttercup.el
+++ b/tests/test-buttercup.el
@@ -1549,7 +1549,7 @@ text properties using `ansi-color-apply'."
(expect (buttercup-suites-total-specs-pending suites) :to-equal 11))
(it "should handle multiple patterns"
(with-local-buttercup :suites suites
- (buttercup-mark-skipped (regexp-opt '("1-1-1" "1-1-2" "1-4" "2-4")) t))
+ (buttercup-mark-skipped '("1-1-1" "1-1-2" "1-4" "2-4") t))
(expect (buttercup-suites-total-specs-defined suites) :to-equal 11)
(expect (buttercup-suites-total-specs-pending suites) :to-equal 8))
(it "should support predicates"
@@ -1567,7 +1567,9 @@ text properties using `ansi-color-apply'."
(expect (buttercup-suites-total-specs-pending suites) :to-equal 6))
(it "should signal an error for invalid matchers"
(with-local-buttercup
- (expect (buttercup-mark-skipped 4) :to-throw)))
+ (expect (buttercup-mark-skipped 4) :to-throw))
+ (with-local-buttercup
+ (expect (buttercup-mark-skipped (list "re" "re" 5 "re")) :to-throw)))
)
;;;;;;;;;;;;;;;;;;;;;
- [nongnu] elpa/buttercup f3c2b00 261/340: test: Move with-local-buttercup to top of file, (continued)
- [nongnu] elpa/buttercup f3c2b00 261/340: test: Move with-local-buttercup to top of file, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0dbd474 263/340: Bump version: 1.20 → 1.21, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 1c9c82f 265/340: Fixed misspelling in the documentation, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 360953b 266/340: test: Only run tests found in the tests/ directory, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 25bc00d 273/340: test: Set up suite "The batch reporter" to use fake terminal, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5c9f80d 279/340: test: Add color tests for buttercup-suite-started and -done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2be9ad3 280/340: test: Add color tests for spec-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0e94f6e 303/340: Lift buttercup-done handling into buttercup-reporter-batch, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f1f403b 308/340: Remove buttercup-reporter-batch-color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup fce5fa5 313/340: Optionally fail when loading old elc files, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6c3bb75 318/340: Accept a list of regexes in buttercup-mark-skipped,
ELPA Syncer <=
- [nongnu] elpa/buttercup 9dda405 320/340: Document use with Eldev, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 06201f2 335/340: Print :to-have-been-called-with args as sexp for consistency, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 459bffb 282/340: test: Add color tests for buttercup-done, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a1c7bff 101/340: Do not ignore errors when after-each succeeds, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b120003 108/340: Merge pull request #60 from howdoicomputer/feature/windows-bin-support, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 06c9699 104/340: Merge pull request #58 from Fuco1/to-equal-as-set, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a6d9bde 105/340: Support more emacs parameters useful for pre-test initialization, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup abf2abe 109/340: Exclude hidden files and dirs in test root, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f60ed2a 119/340: Bump version: 1.5 → 1.6, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 677d6d3 118/340: Merge pull request #70 from xendk/color-output, ELPA Syncer, 2021/12/16