[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors 50851e7 060/434: Add more core tests.
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors 50851e7 060/434: Add more core tests. |
Date: |
Sat, 7 Aug 2021 09:19:55 -0400 (EDT) |
branch: elpa/multiple-cursors
commit 50851e7ac2eccf1e40284ce0265b5943ca7ebc5a
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Add more core tests.
---
features/mark-multiple-integration.feature | 24 +++---
features/multiple-cursors-core.feature | 86 +++++++++++++++++-----
.../step-definitions/multiple-cursors-steps.el | 33 ++++++++-
multiple-cursors-core.el | 2 +
4 files changed, 111 insertions(+), 34 deletions(-)
diff --git a/features/mark-multiple-integration.feature
b/features/mark-multiple-integration.feature
index 80d5b16..e3b2864 100644
--- a/features/mark-multiple-integration.feature
+++ b/features/mark-multiple-integration.feature
@@ -3,23 +3,23 @@ Feature: Mark multiple integration
As an Emacs user with mark-multiple
I want to mark multiple regions and then go to multiple-cursors-mode
- Scenario: Mark two words and change them
+ Scenario: Two cursors
Given there is no region selected
- And delete-selection-mode is active
When I insert "This text contains the word text twice"
And I select "text"
And I press "C->"
- And I type "sentence"
- Then I should see "This sentence contains the word sentence twice"
+ And I press "C-g"
+ Then I should have 2 cursors
- Scenario: Mark two words and go to multiple cursors
+ Scenario: Three cursors
Given there is no region selected
- When I insert "This text contains the word text twice"
+ When I insert:
+ """
+ This text contains the word text thrice, and
+ one of the instances of the word text is on the second line.
+ """
And I select "text"
And I press "C->"
- And I switch to multiple-cursors mode
- And I type "("
- And I press "M-f"
- And I press "M-f"
- And I type ")"
- Then I should see "This (text contains) the word (text twice)"
+ And I press "C->"
+ And I press "C-g"
+ Then I should have 3 cursors
diff --git a/features/multiple-cursors-core.feature
b/features/multiple-cursors-core.feature
index b62de30..8852961 100644
--- a/features/multiple-cursors-core.feature
+++ b/features/multiple-cursors-core.feature
@@ -3,32 +3,80 @@ Feature: Multiple cursors core
As an Emacs user with multiple-cursors
I want to change multiple parts of the buffer at once
- Scenario: Two cursors
+ Scenario: Exiting multiple-cursors mode with return
Given there is no region selected
When I insert "This text contains the word text twice"
And I select "text"
And I press "C->"
- And I switch to multiple-cursors mode
- Then I should have 2 cursors
-
- Scenario: Three cursors
- Given there is no region selected
- When I insert:
- """
- This text contains the word text thrice, and
- one of the instances of the word text is on the second line.
- """
- And I select "text"
- And I press "C->"
- And I press "C->"
- And I switch to multiple-cursors mode
- Then I should have 3 cursors
+ And I press "C-g"
+ And I press "<return>"
+ Then I should have one cursor
- Scenario: Exiting multiple-cursors mode with return
+ Scenario: Exiting multiple-cursors mode with C-g
Given there is no region selected
When I insert "This text contains the word text twice"
And I select "text"
And I press "C->"
- And I switch to multiple-cursors mode
- And I press "<return>"
+ And I press "C-g"
+ And I press "C-g"
Then I should have one cursor
+
+ Scenario: Separate kill-rings
+ Given I have cursors at "text" in "This text contains the word text twice"
+ When I press "M-f"
+ And I press "M-d"
+ And I press "M-b"
+ And I press "C-y"
+ Then I should see "This containstext the word twicetext"
+
+ Scenario: Separate kill-rings, yank-pop
+ Given I have cursors at "text" in "This text contains the word text twice"
+ When I press "M-d"
+ And I press "C-f"
+ And I press "M-d"
+ And I press "C-y M-y"
+ Then I should see "This text the word text"
+
+ Scenario: Interprogram paste
+ Given I have cursors at "text" in "This text contains the word text twice"
+ When I copy "external" in another program
+ And I press "C-y"
+ Then I should see "This externaltext contains the word externaltext twice"
+
+ Scenario: Multiple lambdas
+ Given I have bound C-! to a lambda that inserts "a"
+ And I have cursors at "text" in "This text contains the word text twice"
+ When I press "C-!"
+ Then I should see "This atext contains the word atext twice"
+
+ Scenario: Multiple supported command (forward-word in this case)
+ Given I have cursors at "text" in "This text contains the word text twice"
+ And I type "("
+ And I press "M-f"
+ And I press "M-f"
+ And I type ")"
+ Then I should see "This (text contains) the word (text twice)"
+
+ Scenario: Setting and popping mark
+ Given I have cursors at "text" in "This text contains the word text twice"
+ And I press "C-SPC"
+ And I press "M-f"
+ And I press "C-u C-SPC"
+ And I type "!"
+ Then I should see "This !text contains the word !text twice"
+
+ Scenario: delete-selection-mode (self-insert-command)
+ Given I turn on delete-selection-mode
+ And I have cursors at "text" in "This text contains the word text twice"
+ And I press "C-SPC"
+ And I press "M-f"
+ And I type "!"
+ Then I should see "This ! contains the word ! twice"
+
+ Scenario: delete-selection-mode (delete-char)
+ Given I turn on delete-selection-mode
+ And I have cursors at "text" in "This text contains the word text twice"
+ And I press "C-SPC"
+ And I press "M-f"
+ And I press "C-d"
+ Then I should see "This contains the word twice"
diff --git a/features/step-definitions/multiple-cursors-steps.el
b/features/step-definitions/multiple-cursors-steps.el
index 35349f7..0ade5ec 100644
--- a/features/step-definitions/multiple-cursors-steps.el
+++ b/features/step-definitions/multiple-cursors-steps.el
@@ -22,6 +22,33 @@
(assert (eq 1 (num-cursors)) nil
"Expected to have one cursor, but there are still fake cursor
overlays.")))
-(And "^I switch to multiple-cursors mode$"
- (lambda ()
- (mc/switch-from-mark-multiple-to-cursors)))
+(When "^I press \"\\(.+\\)\"$"
+ (lambda (keybinding)
+ (let ((macro (edmacro-parse-keys keybinding)))
+ (if espuds-chain-active
+ (setq espuds-action-chain (vconcat espuds-action-chain macro))
+ (if (and (equal keybinding "C-g")
+ (eq (key-binding (kbd "C-g")) 'keyboard-quit))
+ (espuds-quit)
+ (execute-kbd-macro macro))))))
+
+(Given "^I have cursors at \"\\(.+\\)\" in \"\\(.+\\)\"$"
+ (lambda (needle haystack)
+ (insert haystack)
+ (goto-char (point-min))
+ (search-forward needle)
+ (set-mark (point))
+ (goto-char (match-beginning 0))
+ (mark-all-like-this)
+ (mc/switch-from-mark-multiple-to-cursors)))
+
+(When "^I copy \"\\(.+\\)\" in another program$"
+ (lambda (text)
+ (lexical-let ((text text))
+ (setq interprogram-paste-function
+ #'(lambda () (let ((r text)) (setq text nil) r))))))
+
+(Given "^I have bound C-! to a lambda that inserts \"\\(.+\\)\"$"
+ (lambda (ins)
+ (lexical-let ((ins ins))
+ (global-set-key (kbd "C-!") #'(lambda () (interactive) (insert
ins))))))
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index ab9b568..e3309dc 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -228,6 +228,8 @@ from being executed if in multiple-cursors-mode."
undo
undo-tree-undo
undo-tree-redo
+ universal-argument
+ universal-argument-other-key
mc/switch-from-mark-multiple-to-cursors))
;; Commands that should be mirrored by all cursors
- [nongnu] elpa/multiple-cursors 71f444a 050/434: Remove unused commands from whitelist., (continued)
- [nongnu] elpa/multiple-cursors 71f444a 050/434: Remove unused commands from whitelist., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 822bf18 056/434: Update test., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 700db99 062/434: Add kill-ring-save to whitelist., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ed678df 061/434: Couple more core-tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a19c8c3 077/434: Add cycle-backwards to once-list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 51b282e 078/434: Switch to multiple-cursors-mode from rectangular-region-mode when doing expand-region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors c331366 099/434: Add multiple-cursors-pkg, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4c91260 004/434: Updated readme., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 399db27 012/434: More white-listed commands:, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fca0685 055/434: Use symbol properties on commands instead of maintaining a list of unsupported commands., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 50851e7 060/434: Add more core tests.,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors de0519e 057/434: Add support for running lambdas for each cursor., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 8ec468f 080/434: Don't save .mc-list.el when running tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4003aa1 102/434: Replace outdated function name with new one, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 605894d 121/434: Add link to video., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 26544fa 126/434: Bump version to 1.1.0, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 466d8bd 127/434: Don't use next-line non-interactively, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 80bc6f6 135/434: Temporarily disable auto-complete-mode in multiple-cursors-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 80ebdbb 156/434: Added test for mc/mark-(next|previous)-like-this when there is no active region., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 324d935 157/434: Split macro mc/for-each-fake-cursor into a function returning all the cursor overlays and a macro to loop over this list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a8b6323 159/434: Remove superfluous lambda., ELPA Syncer, 2021/08/07