[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors eda9952 058/434: Finally got the tests ru
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors eda9952 058/434: Finally got the tests running. :-) |
Date: |
Sat, 7 Aug 2021 09:19:54 -0400 (EDT) |
branch: elpa/multiple-cursors
commit eda9952fc029b28b8ee3f83b5b0b4f1026eac39c
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Finally got the tests running. :-)
---
features/mark-multiple-integration.feature | 9 ++++----
features/multiple-cursors-core.feature | 25 ++++++++++++++++++++--
.../step-definitions/multiple-cursors-steps.el | 23 ++++++++++++++------
features/support/env.el | 1 +
multiple-cursors-core.el | 7 +++---
5 files changed, 50 insertions(+), 15 deletions(-)
diff --git a/features/mark-multiple-integration.feature
b/features/mark-multiple-integration.feature
index 4053296..80d5b16 100644
--- a/features/mark-multiple-integration.feature
+++ b/features/mark-multiple-integration.feature
@@ -17,8 +17,9 @@ Feature: Mark multiple integration
When I insert "This text contains the word text twice"
And I select "text"
And I press "C->"
- And I press "C-g"
- And I type "'"
+ And I switch to multiple-cursors mode
+ And I type "("
And I press "M-f"
- And I type "'"
- Then I should see "This 'text' contains the word 'text' twice"
+ And I press "M-f"
+ And I type ")"
+ Then I should see "This (text contains) the word (text twice)"
diff --git a/features/multiple-cursors-core.feature
b/features/multiple-cursors-core.feature
index 63ef45f..b62de30 100644
--- a/features/multiple-cursors-core.feature
+++ b/features/multiple-cursors-core.feature
@@ -5,9 +5,30 @@ Feature: Multiple cursors core
Scenario: Two cursors
Given there is no region selected
- When I insert "This text contains the word text thrice (text)"
+ 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 press "C-g"
+ And I switch to multiple-cursors mode
Then I should have 3 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
+ And I press "<return>"
+ Then I should have one cursor
diff --git a/features/step-definitions/multiple-cursors-steps.el
b/features/step-definitions/multiple-cursors-steps.el
index 7f750d3..35349f7 100644
--- a/features/step-definitions/multiple-cursors-steps.el
+++ b/features/step-definitions/multiple-cursors-steps.el
@@ -1,16 +1,27 @@
(And "^delete-selection-mode is active$"
(lambda ()
- (delete-selection-mode 1)))
+ (delete-selection-mode 1)))
(defun is-extra-cursor-p (o)
- (message "overlay-type: %S" (overlay-get o 'type))
(eq (overlay-get o 'type) 'additional-cursor))
(defun num-cursors ()
(1+ (count-if 'is-extra-cursor-p
- (overlays-in (point-min) (point-max)))))
+ (overlays-in (point-min) (point-max)))))
(Then "^I should have \\([0-9]+\\) cursors$"
- (lambda (num)
- (assert (eq (string-to-number num) (num-cursors)) nil
- "Expected to have %s cursors, but was %d." num
(num-cursors))))
+ (lambda (num)
+ (let ((actual (num-cursors)))
+ (assert (eq (string-to-number num) actual) nil
+ "Expected to have %s cursors, but was %d." num actual))))
+
+(Then "^I should have one cursor$"
+ (lambda ()
+ (assert (not multiple-cursors-mode) nil
+ "Expected to have one cursor, but multiple-cursors-mode is
still active.")
+ (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)))
diff --git a/features/support/env.el b/features/support/env.el
index 686073d..a93cac3 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -14,6 +14,7 @@
(require 'ert)
(Before
+ (multiple-cursors-mode 0)
(mm/clear-all)
(global-set-key (kbd "C->") 'mark-next-like-this)
(switch-to-buffer
diff --git a/multiple-cursors-core.el b/multiple-cursors-core.el
index 910dfdc..ab9b568 100644
--- a/multiple-cursors-core.el
+++ b/multiple-cursors-core.el
@@ -144,7 +144,7 @@ cursors."
original-command
(get original-command 'mc--unsupported))
(if (not (memq original-command mc--cmds))
- (when (not (memq original-command mc--cmds-run-once))
+ (when (and original-command (not (memq original-command
mc--cmds-run-once)))
(message "Skipping %S" original-command))
(mc/execute-command-for-all-fake-cursors original-command))))))
@@ -222,12 +222,13 @@ from being executed if in multiple-cursors-mode."
(overlay-put cursor 'kill-ring-yank-pointer
kill-ring-yank-pointer)))))))
;;----------------------------------------------------------------------------------------
-;; Commands to run only once (not yet in use)
+;; Commands to run only once (don't need to message about skipping it)
(setq mc--cmds-run-once '(mark-next-like-this
save-buffer
undo
undo-tree-undo
- undo-tree-redo))
+ undo-tree-redo
+ mc/switch-from-mark-multiple-to-cursors))
;; Commands that should be mirrored by all cursors
(setq mc--cmds '(mc/keyboard-quit
- [nongnu] elpa/multiple-cursors 1afbb93 175/434: Add mc/cycle-looping-behaviour to multiple-cursors custom group., (continued)
- [nongnu] elpa/multiple-cursors 1afbb93 175/434: Add mc/cycle-looping-behaviour to multiple-cursors custom group., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ed18fa4 222/434: Merge pull request #62 from tkf/export-ECUKES_EMACS, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 424e066 198/434: 1.1.5, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 374244b 232/434: Add support for C-s and C-r when phi-search is installed, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 53db250 237/434: Added a mark-pop.feature file., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 69c9961 234/434: Use Carton for dev dependencies, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 75df47f 236/434: Added mention of mc/mark-pop to README.md, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1cb894d 242/434: Add more mc-specific commands to the run-once list, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 47e03d5 249/434: Release 1.2.2, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 4a7fb32 059/434: Autotest, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors eda9952 058/434: Finally got the tests running. :-),
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors 1d5b54e 070/434: Separate default cmd-lists and those populated by the end user., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 398cc9e 251/434: Merge pull request #92 from knu/mark_by_logical_lines, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e8d7344 252/434: Fix the doc string of mc/mark-pop, which was not updated after a copy., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 45c6cd0 256/434: Add mc/mark-all-dwim, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors e28090d 259/434: Merge pull request #106 from porterjamesj/patch-1, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d69ae15 073/434: Use setq for default lists to be able to re-evaluate., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 487e8be 006/434: Added docstrings to each function., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a4d406e 011/434: Conclude multiple-cursors-mode with <return>, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors dcd9c52 022/434: Add new feature test., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 03dfc70 024/434: A working multiple-regions implementation, with some issues., ELPA Syncer, 2021/08/07