[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/with-simulated-input 9a2ba67eba 009/134: Switch to using b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/with-simulated-input 9a2ba67eba 009/134: Switch to using buttercup as the test suite |
Date: |
Mon, 10 Jan 2022 22:59:59 -0500 (EST) |
branch: elpa/with-simulated-input
commit 9a2ba67ebac318182b14f8d87e912c244f9c9024
Author: Ryan C. Thompson <rct@thompsonclan.org>
Commit: Ryan C. Thompson <rct@thompsonclan.org>
Switch to using buttercup as the test suite
---
.travis.yml | 2 +-
Cask | 7 ++--
test/test-helper.el | 40 -----------------------
test/with-simulated-input-test.el | 65 -------------------------------------
tests/test-with-simulated-input.el | 66 ++++++++++++++++++++++++++++++++++++++
5 files changed, 72 insertions(+), 108 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index ef9d93cea6..261debf042 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,4 +30,4 @@ before_script:
- cask install
script:
- cask exec ert-runner
+ cask exec buttercup -L .
diff --git a/Cask b/Cask
index 67c25d8267..e40b72a0d5 100644
--- a/Cask
+++ b/Cask
@@ -9,5 +9,8 @@
(depends-on "seq")
(development
- (depends-on "f")
- (depends-on "ert-runner"))
+ (depends-on "buttercup"
+ :git "https://github.com/DarwinAwardWinner/emacs-buttercup.git";
+ :branch "show-exprs"
+ :files ("*.el"
+ ("bin" "bin/*"))))
diff --git a/test/test-helper.el b/test/test-helper.el
deleted file mode 100644
index 2cb7a30ccd..0000000000
--- a/test/test-helper.el
+++ /dev/null
@@ -1,40 +0,0 @@
-;;; test-helper.el --- -*- lexical-binding: t -*-
-
-;; Copyright (C) 2015 Ryan C. Thompson
-
-;; Filename: test-helper.el
-;; Author: Ryan C. Thompson
-;; Created: Sat Nov 21 15:27:00 2015 (-0800)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; This program is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or (at
-;; your option) any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but
-;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-;; General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;;; Code:
-
-(require 'f)
-
-(defvar test-path
- (f-dirname (f-this-file)))
-
-(defvar code-path
- (f-parent test-path))
-
-(add-to-list 'load-path code-path)
-
-(require 'with-simulated-input)
-
-;;; test-helper.el ends here
diff --git a/test/with-simulated-input-test.el
b/test/with-simulated-input-test.el
deleted file mode 100644
index 43acc0979e..0000000000
--- a/test/with-simulated-input-test.el
+++ /dev/null
@@ -1,65 +0,0 @@
-;;; -*- lexical-binding: t -*-
-
-(require 'with-simulated-input)
-(require 'ert)
-(require 'cl-lib)
-
-(ert-deftest read-simulated-input ()
- :tags '(with-simulated-input)
- "Tests for the basic functionality of the `with-simulated-input' macro."
- ;; Basic string input
- (should
- (string=
- "hello"
- (with-simulated-input "hello RET"
- (read-string "Enter a string: "))))
- ;; Error if RET is not pressed to finish the input
- (should-error
- (with-simulated-input "hello"
- (read-string "Enter a string: ")))
- ;; Can throw an error manually
- (should-error
- (with-simulated-input
- "(error SPC \"Manually SPC throwing SPC an SPC error\") RET"
- (command-execute 'eval-expression)))
- ;; Extra keys should not cause errors
- (should
- (string=
- "hello"
- (with-simulated-input
- "hello RET M-x eval-expression (error SPC \"Manually SPC throwing SPC
an SPC error\") RET"
- (read-string "Enter a string: "))))
- ;; A single input sequence can feed multiple functions
- (should
- (equal
- '("hello" "world")
- (with-simulated-input "hello RET world RET"
- (list (read-string "First word: ")
- (read-string "Second word: "))))))
-
-(ert-deftest complete-with-simulated-input ()
- :tags '(with-simulated-input)
- "Tests for `with-simulated-input' with `completing-read'."
- (let ((collection '("bluebird" "blueberry" "bluebell" "bluegrass"
"baseball"))
- (completing-read-function #'completing-read-default))
- ;; Unambiguous completion
- (should
- (string=
- "bluebird"
- ;; First TAB completes "blue", 2nd completes "bird"
- (with-simulated-input "bl TAB bi TAB RET"
- (completing-read "Choose: " collection))))
- ;; Ambiguous completion
- (should
- (string=
- "blue"
- (with-simulated-input "bl TAB C-j"
- (completing-read "Choose: " collection))))
- ;; Ambiguous completion with require-match
- (should-error
- (with-simulated-input "bl TAB C-j"
- (completing-read "Choose: " collection nil t)))))
-
-(provide 'with-simulated-input-test)
-
-;;; ido-ubiquitous-test.el ends here
diff --git a/tests/test-with-simulated-input.el
b/tests/test-with-simulated-input.el
new file mode 100644
index 0000000000..b47e25c070
--- /dev/null
+++ b/tests/test-with-simulated-input.el
@@ -0,0 +1,66 @@
+;;; -*- lexical-binding: t -*-
+
+(require 'with-simulated-input)
+(require 'cl-lib)
+(require 'buttercup)
+
+(describe "Basic functionality of `with-simulated-input'"
+ (it "should work for basic string input"
+ (expect
+ (with-simulated-input "hello RET"
+ (read-string "Enter a string: "))
+ :to-equal "hello"))
+ (it "should throw an error if the input is incomplete"
+ (expect
+ (lambda ()
+ (with-simulated-input "hello"
+ (read-string "Enter a string: ")))
+ :to-throw))
+ (it "should allow the input to trigger errors"
+ (expect
+ (lambda ()
+ (with-simulated-input
+ "(error SPC \"Manually SPC throwing SPC an SPC error\") RET"
+ (command-execute 'eval-expression)))
+ :to-throw))
+ (it "should ignore extra input after BODY has completed"
+ (expect
+ (with-simulated-input
+ "hello RET M-x eval-expression (error SPC \"Manually SPC throwing SPC
an SPC error\") RET"
+ (read-string "Enter a string: "))
+ :to-equal "hello"))
+ (it "should allow multiple functions in BODY to read input"
+ (expect
+ (with-simulated-input "hello RET world RET"
+ (list (read-string "First word: ")
+ (read-string "Second word: ")))
+ :to-equal '("hello" "world")))
+ (it "should not allow `C-g' in the input"
+ (expect
+ (lambda ()
+ (with-simulated-input "C-g" (ignore)))
+ :to-throw)))
+
+(describe "Using `with-simulated-input' with `completing-read'"
+ :var ((collection '("bluebird" "blueberry" "bluebell" "bluegrass"
"baseball"))
+ (completing-read-function #'completing-read-default))
+ ;; Unambiguous completion
+ (it "should work with unambiguous tab completion"
+ (expect
+ ;; First TAB completes "blue", 2nd completes "bird"
+ (with-simulated-input "bl TAB bi TAB RET"
+ (completing-read "Choose: " collection))
+ :to-equal "bluebird"))
+ (it "should work with ambiguous tab completion"
+ (expect
+ (with-simulated-input "bl TAB C-j"
+ (completing-read "Choose: " collection))
+ :to-equal "blue"))
+ (it "should fail to exit with ambiguous completion and `require-match'"
+ (expect
+ (lambda ()
+ (with-simulated-input "bl TAB C-j"
+ (completing-read "Choose: " collection nil t)))
+ :to-throw)))
+
+;;; test-with-simulated-input.el ends here
- [nongnu] elpa/with-simulated-input c377a673c8 127/134: Prefix unused variables with underscores, (continued)
- [nongnu] elpa/with-simulated-input c377a673c8 127/134: Prefix unused variables with underscores, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 63297040ad 052/134: Switch from Cask to Eldev, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input a5c955085d 055/134: Fix some warnings in test file, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 0d5e910f19 061/134: Add an error message for unhandled case, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 228732caf5 063/134: Enable undercover in CI, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 2a83333b6d 121/134: Update the edebug spec to include characters, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 166a00980a 131/134: Remove some unused test code, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 6f338aeaed 003/134: Add a README, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 5a67067ae0 002/134: Initial version, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4fec23e53b 001/134: Inital empty commit, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 9a2ba67eba 009/134: Switch to using buttercup as the test suite,
ELPA Syncer <=
- [nongnu] elpa/with-simulated-input 9d7afd6e6c 007/134: Delete some extraneous whitespace, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 322dc7ed95 008/134: Add some more tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4c68e02cc1 010/134: Allow evaluating lisp forms while simulating input, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 5701347987 013/134: Update the readme with new instructions for running tests, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input ad9eaf2252 014/134: Add info on idle simulation to README, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 4932368712 016/134: Add MELPA links, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 33b40e59a1 018/134: Fix indentation, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 004218b75c 023/134: Add more info to docstring for wsi-simulated-idle-time, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input 395a985348 026/134: Use gensym to generate the canary symbol, ELPA Syncer, 2022/01/10
- [nongnu] elpa/with-simulated-input e66a24d067 031/134: Add Makefile and code coverage, ELPA Syncer, 2022/01/10