diff options
author | Florian Bruhin <git@the-compiler.org> | 2017-10-17 06:26:42 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2017-10-17 06:27:07 +0200 |
commit | cb527913dc68635b6bdf83451e827f73f62551a4 (patch) | |
tree | 787befbf12de4c63273599dd2b6c1ba9c8c0695c | |
parent | ddfa82345cc34e7608211c1d5ecda5192d45509e (diff) | |
download | qutebrowser-cb527913dc68635b6bdf83451e827f73f62551a4.tar.gz qutebrowser-cb527913dc68635b6bdf83451e827f73f62551a4.zip |
Show better error message when trying to toggle with :set
(cherry picked from commit d8384ced0a958e9841dfbb7f7b0d75f1f8c92f19)
-rw-r--r-- | doc/changelog.asciidoc | 5 | ||||
-rw-r--r-- | qutebrowser/config/configcommands.py | 4 | ||||
-rw-r--r-- | tests/unit/config/test_configcommands.py | 14 |
3 files changed, 21 insertions, 2 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 61235cee2..fa6f7a765 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -26,6 +26,11 @@ Fixes - 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 ------ diff --git a/qutebrowser/config/configcommands.py b/qutebrowser/config/configcommands.py index 5848c9680..340175f23 100644 --- a/qutebrowser/config/configcommands.py +++ b/qutebrowser/config/configcommands.py @@ -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 diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py index 1841e6260..c33bb54d4 100644 --- a/tests/unit/config/test_configcommands.py +++ b/tests/unit/config/test_configcommands.py @@ -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?'. |