[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/buttercup 238bfa8 082/340: Support --pattern command line
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/buttercup 238bfa8 082/340: Support --pattern command line argument |
Date: |
Thu, 16 Dec 2021 14:59:08 -0500 (EST) |
branch: elpa/buttercup
commit 238bfa84538e95bfeb3430feb5bd9be4f4f4b906
Author: Jorgen Schaefer <contact@jorgenschaefer.de>
Commit: Jorgen Schaefer <contact@jorgenschaefer.de>
Support --pattern command line argument
With this argument, buttercup can now restrict the tests to be run to
a subset matching a given regular expression.
Fixes #21
---
bin/buttercup | 29 +++++++++++++++++++++++++++--
buttercup.el | 43 +++++++++++++++++++++++++++++++++++++------
2 files changed, 64 insertions(+), 8 deletions(-)
diff --git a/bin/buttercup b/bin/buttercup
index 62a9ba7..71f6740 100755
--- a/bin/buttercup
+++ b/bin/buttercup
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
if [ -n "$INSIDE_EMACS" ]
then
@@ -7,4 +7,29 @@ else
EMACS_BIN="${EMACS:-emacs}"
fi
-exec "$EMACS_BIN" -batch "$@" -l buttercup -f buttercup-run-discover
+EMACS_ARGS=()
+BUTTERCUP_ARGS=()
+
+while [[ "$#" -gt 0 ]]
+do
+ case "$1" in
+ "-L")
+ EMACS_ARGS+=("$1")
+ EMACS_ARGS+=("$2")
+ shift
+ shift
+ ;;
+ "-p"|"--pattern")
+ BUTTERCUP_ARGS+=("$1")
+ BUTTERCUP_ARGS+=("$2")
+ shift
+ shift
+ ;;
+ *)
+ BUTTERCUP_ARGS+=("$1")
+ shift
+ ;;
+ esac
+done
+
+exec "$EMACS_BIN" -batch "${EMACS_ARGS[@]}" -l buttercup -f
buttercup-run-discover "${BUTTERCUP_ARGS[@]}"
diff --git a/buttercup.el b/buttercup.el
index af38153..6e23e4f 100644
--- a/buttercup.el
+++ b/buttercup.el
@@ -631,12 +631,43 @@ KEYWORD can have one of the following values:
Takes directories as command line arguments, defaulting to the
current directory."
- (dolist (dir (or command-line-args-left '(".")))
- (dolist (file (directory-files-recursively
- dir "\\`test-.*\\.el\\'\\|-test\\.el\\'"))
- (when (not (string-match "/\\." (file-relative-name file)))
- (load file nil t))))
- (buttercup-run))
+ (let ((dirs nil)
+ (patterns nil)
+ (args command-line-args-left))
+ (message "c-l-a-l: %S" args)
+ (while args
+ (cond
+ ((member (car args) '("-p" "--pattern"))
+ (when (not (cdr args))
+ (error "Option requires argument" (car args)))
+ (push (cadr args) patterns)
+ (setq args (cddr args)))
+ (t
+ (push (car args) dirs)
+ (setq args (cdr args)))))
+ (setq command-line-args-left nil)
+ (dolist (dir (or dirs '(".")))
+ (dolist (file (directory-files-recursively
+ dir "\\`test-.*\\.el\\'\\|-test\\.el\\'"))
+ (when (not (string-match "/\\." (file-relative-name file)))
+ (load file nil t))))
+ (when patterns
+ (let ((suites-or-specs buttercup-suites))
+ (while suites-or-specs
+ (cond
+ ((buttercup-suite-p (car suites-or-specs))
+ (setq suites-or-specs (append suites-or-specs
+ (buttercup-suite-children
+ (car suites-or-specs)))))
+ ((buttercup-spec-p (car suites-or-specs))
+ (catch 'return
+ (dolist (p patterns)
+ (when (string-match p (buttercup-spec-full-name (car
suites-or-specs)))
+ (throw 'return t)))
+ (setf (buttercup-spec-function (car suites-or-specs))
+ (lambda () (signal 'buttercup-pending t))))))
+ (setq suites-or-specs (cdr suites-or-specs)))))
+ (buttercup-run)))
;;;###autoload
(defun buttercup-run-markdown ()
- [nongnu] elpa/buttercup 6d96ea3 093/340: Add format specifier to error call with argument, (continued)
- [nongnu] elpa/buttercup 6d96ea3 093/340: Add format specifier to error call with argument, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup cef9988 110/340: Merge pull request #61 from spwhitton/fix-regexp, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 2b5f53d 121/340: [Fix #72] Add buttercup-minor-mode, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 5db07c9 112/340: Merge pull request #63 from ebpa/patch-1, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup a05fdcb 117/340: Colorize output, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ed649d7 125/340: Merge pull request #76 from DamienCassou/make-buttercup--with-cleanup-public, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ce75b50 115/340: Report load errors in buttercup-run-discover, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 3deb9a4 053/340: Test discovery: Ignore files in dot directories., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 444716b 079/340: Handle windows better in interactive runs., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 512b82b 077/340: Rework documentation to make the readme more concise., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 238bfa8 082/340: Support --pattern command line argument,
ELPA Syncer <=
- [nongnu] elpa/buttercup 5cbd468 084/340: Bump version: 1.2 → 1.3, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup ba8cd05 106/340: Merge pull request #59 from immerrr/add-other-emacs-params, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 07c525e 116/340: Merge pull request #68 from ebpa/report-load-errors, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 11f072f 123/340: Merge pull request #81 from DamienCassou/fix-to-have-same-items-as, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 562cdb0 058/340: The buttercup-suite-full-name function., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup d264da3 075/340: Merge pull request #17 from Fuco1/master, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 8c486e6 067/340: Move print settings to the batch reporter where they belong., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 0f3eb63 078/340: Show actual function arguments when a spy fails., ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 357e73b 085/340: Remove debug message, ELPA Syncer, 2021/12/16
- [nongnu] elpa/buttercup 68692d9 113/340: Update Travis configuration instructions, ELPA Syncer, 2021/12/16