Added testcase for mc-hide-unmatched-lines-mode

This commit is contained in:
lexa 2014-08-04 23:36:01 +04:00
parent 653d52352d
commit bf9e8e95e0
2 changed files with 100 additions and 0 deletions

View File

@ -0,0 +1,73 @@
Feature: Hiding lines without cursor
Scenario: Hiding lines when three cursor active
Given I have cursors at "line" in :
"""
0
line
2
3
line
5
6
7
8
9
10
11
line
13
14
15
"""
And I press "C-'"
Then I should have 3 cursors
Then I should see exactly:
"""
0
line
2
3
line
5
6
10
11
line
13
14
"""
Scenario: Hiding lines when only two cursor active
When I insert:
"""
1
2
3
4
5
text
6
7
8
9
10
"""
And I go to the front of the word "text"
And I press "C->"
And I press "C-'"
Then I should have 2 cursors
Then I should see exactly:
"""
4
5
text
6
7
8
"""

View File

@ -79,6 +79,17 @@
(mc/mark-all-like-this)
(mc/keyboard-quit)))
(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))
(mc/mark-all-like-this)
(mc/keyboard-quit)))
(When "^I copy \"\\(.+\\)\" in another program$"
(lambda (text)
(lexical-let ((text text))
@ -137,3 +148,19 @@
(split-string rest))
"-"))))
(call-interactively func))))
(Then "^I should see exactly\\(?: \"\\(.+\\)\"\\|:\\)$"
"Asserts that the current buffer does not include some text with
respect of text hidden by overlays"
(lambda (expected)
(let ((p (point-min))
(visible-text "")
(message "Expected '%s' to be part of '%s', but was not found in current buffer.")
)
(while (not (= p (point-max)))
(if (not (invisible-p p))
(setq visible-text (concat visible-text (buffer-substring p (1+ p))))
)
(setq p (1+ p))
)
(cl-assert (s-equals? expected visible-text) nil message expected visible-text))))