Add tests for repeat-command, make compatible with different count methods
This commit is contained in:
parent
7a6d26ef86
commit
cc1899ebca
@ -292,7 +292,8 @@ class CommandRunner(QObject):
|
||||
(result.cmd._not_modes is None or
|
||||
usertypes.KeyMode.normal not in result.cmd._not_modes)):
|
||||
global last_command
|
||||
last_command = (text, count)
|
||||
last_command = (self._parse_count(text)[1],
|
||||
count if count is not None else result.count)
|
||||
|
||||
@pyqtSlot(str, int)
|
||||
@pyqtSlot(str)
|
||||
|
34
tests/end2end/features/repeatcommand.feature
Normal file
34
tests/end2end/features/repeatcommand.feature
Normal file
@ -0,0 +1,34 @@
|
||||
Feature: Repeating
|
||||
Test the repeat-command command.
|
||||
|
||||
Background:
|
||||
Given I run :tab-only
|
||||
|
||||
Scenario: :repeat-command
|
||||
When I open data/numbers/1.txt
|
||||
And I open data/numbers/2.txt in a new tab
|
||||
And I open data/numbers/3.txt in a new tab
|
||||
And I run :tab-close with count 1
|
||||
And I run :repeat-command
|
||||
Then the following tabs should be open:
|
||||
- data/numbers/3.txt (active)
|
||||
|
||||
Scenario: :repeat-command with count
|
||||
When I open data/numbers/1.txt
|
||||
And I open data/numbers/2.txt in a new tab
|
||||
And I open data/numbers/3.txt in a new tab
|
||||
And I run :tab-close with count 1
|
||||
And I run :repeat-command with count 2
|
||||
Then the following tabs should be open:
|
||||
- data/numbers/2.txt (active)
|
||||
|
||||
Scenario: :repeat-command with not-normal command inbetween
|
||||
When I open data/numbers/1.txt
|
||||
And I open data/numbers/2.txt in a new tab
|
||||
And I open data/numbers/3.txt in a new tab
|
||||
And I run :tab-close with count 1
|
||||
And I run :prompt-accept
|
||||
And I run :repeat-command
|
||||
Then the following tabs should be open:
|
||||
- data/numbers/3.txt (active)
|
||||
And the error "prompt-accept: This command is only allowed in prompt/yesno mode." should be shown
|
21
tests/end2end/features/test_repeatcommand_bbd.py
Normal file
21
tests/end2end/features/test_repeatcommand_bbd.py
Normal file
@ -0,0 +1,21 @@
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2016 Jan Verbeek (blyxxyz) <ring@openmailbox.org>
|
||||
#
|
||||
# This file is part of qutebrowser.
|
||||
#
|
||||
# qutebrowser 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.
|
||||
#
|
||||
# qutebrowser 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 qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest_bdd as bdd
|
||||
bdd.scenarios('repeatcommand.feature')
|
Loading…
Reference in New Issue
Block a user