[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 0e5eae0 321/340: Merge pull request #192 from sn
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 0e5eae0 321/340: Merge pull request #192 from snogge/re-patterns |
Date: |
Thu, 16 Dec 2021 14:59:59 -0500 (EST) |
branch: elpa/buttercup
commit 0e5eae0766a33b5c8997e1477e3914d5c8ba3d29
Merge: 4d974d2 6c3bb75
Author: Ola Nilsson <ola.nilsson@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #192 from snogge/re-patterns
Re-enable regex patterns on the command line, fix #191
---
bin/buttercup | 9 +++++----
bin/buttercup.bat | 25 ++++++++++++++++++++++++-
buttercup.el | 17 ++++++++++++-----
tests/test-buttercup.el | 6 ++++--
4 files changed, 45 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 092230a..edff81d 100644
--- a/bin/buttercup.bat
+++ b/bin/buttercup.bat
@@ -33,7 +33,19 @@ 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
+echo with "xit". Tests skipped wiath "assume" will
+echo still be priuted,
+echo.
+echo --only-error Only print failed tests and their containing
suites.
+echo Implies "--no-skip".
echo.
echo --no-color, -c Do not colorize test output.
echo.
@@ -49,6 +61,8 @@ echo each stack frame, and also
annotates each
echo frame with a lambda or M to indicate whether
echo it is a normal function call or a
echo macro/special form.
+echo.
+echo --stale-file-error Fail the test run if stale .elc files are loaded.
exit /b
:parse_args
@@ -110,6 +124,15 @@ if not [%current_arg%]==[] (
) else if !current_arg!==--no-color (
set buttercup_args=!buttercup_args! !current_arg!
shift /1
+ ) else if !current_arg!==--no-skip (
+ set buttercup_args=!buttercup_args! !current_arg!
+ shift /1
+ ) else if !current_arg!==--only-error (
+ set buttercup_args=!buttercup_args! !current_arg!
+ shift /1
+ ) else if !current_arg!==--stale-file-error (
+ set buttercup_args=!buttercup_args! !current_arg!
+ shift /1
) else if !current_arg!==--traceback (
set buttercup_args=!buttercup_args! !current_arg! !next_arg!
shift /1
diff --git a/buttercup.el b/buttercup.el
index 435fead..3b2154a 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 2d77e18 300/340: test: Correct descriptions for some suite-done specs, (continued)
- [nongnu] elpa/buttercup 2d77e18 300/340: test: Correct descriptions for some suite-done specs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d41c6dc 301/340: Extract buttercup-reporter-batch--print-summary, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 74e74e2 302/340: Extract buttercup-reporter-batch--print-failed-spec-report, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 52f0bec 305/340: Make buttercup-colorize treat nil as no color, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a8f4cff 311/340: test: Correct descriptions for ERT compatibility specs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 995a4f1 312/340: Add missing docstrings, correct some other docstrings, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 110a9b6 314/340: test: Use pretty traceback, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a9647cb 316/340: Bump version: 1.22 → 1.23, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup b76ff35 317/340: Update buttercup.bat to handle all options, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 62a34c7 322/340: Remove elc files in tests on make clean, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0e5eae0 321/340: Merge pull request #192 from snogge/re-patterns,
ELPA Syncer <=
- [nongnu] elpa/buttercup e0b5d9f 324/340: Correct error message in buttercup--format-stack-frame, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 843fa6f 327/340: Keep the actual variable definition with the reporter, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 315a891 326/340: Fix stack frame collection in buttercup--backtrace, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup cccdedf 334/340: Merge pull request #197 from snogge/omit-traceback, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup bef49f5 323/340: Remove extra newline in error backtrace, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 6ef715f 328/340: Use buttercup--mark-stackframe to mark the start of test code, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2f24a44 338/340: Make formatting of backtrace frames closer to that standard for Emacs, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup f6f9335 337/340: test: Add tests for buttercup-run-discovery, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 553ff83 103/340: Add :to-have-same-items-as to compare lists as sets., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 657acef 102/340: Bump version: 1.4 → 1.5, ELPA Syncer, 2021/12/16