Show better error message when trying to toggle with :set
This commit is contained in:
parent
544c508fac
commit
d8384ced0a
@ -42,6 +42,11 @@ Fixed
|
||||
- Handle a filesystem going read-only gracefully
|
||||
- Fix wrong rendering of keys like `<back>` in the completion
|
||||
|
||||
Changed
|
||||
~~~~~~~
|
||||
|
||||
- Nicer error messages and other minor improvements
|
||||
|
||||
v1.0.1
|
||||
------
|
||||
|
||||
|
@ -75,6 +75,10 @@ class ConfigCommands:
|
||||
tabbed_browser.openurl(QUrl('qute://settings'), newtab=False)
|
||||
return
|
||||
|
||||
if option.endswith('!'):
|
||||
raise cmdexc.CommandError("Toggling values was moved to the "
|
||||
":config-cycle command")
|
||||
|
||||
if option.endswith('?') and option != '?':
|
||||
self._print_value(option[:-1])
|
||||
return
|
||||
|
@ -133,9 +133,9 @@ class TestSet:
|
||||
"QtWebEngine backend!"):
|
||||
commands.set(0, 'content.cookies.accept', 'all')
|
||||
|
||||
@pytest.mark.parametrize('option', ['?', '!', 'url.auto_search'])
|
||||
@pytest.mark.parametrize('option', ['?', 'url.auto_search'])
|
||||
def test_empty(self, commands, option):
|
||||
"""Run ':set ?' / ':set !' / ':set url.auto_search'.
|
||||
"""Run ':set ?' / ':set url.auto_search'.
|
||||
|
||||
Should show an error.
|
||||
See https://github.com/qutebrowser/qutebrowser/issues/1109
|
||||
@ -145,6 +145,16 @@ class TestSet:
|
||||
"value"):
|
||||
commands.set(win_id=0, option=option)
|
||||
|
||||
def test_toggle(self, commands):
|
||||
"""Try toggling a value.
|
||||
|
||||
Should show an nicer error.
|
||||
"""
|
||||
with pytest.raises(cmdexc.CommandError,
|
||||
match="Toggling values was moved to the "
|
||||
":config-cycle command"):
|
||||
commands.set(win_id=0, option='javascript.enabled!')
|
||||
|
||||
def test_invalid(self, commands):
|
||||
"""Run ':set foo?'.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user