Add some tests for key config migrations.
This commit is contained in:
parent
f6ef657952
commit
5d13d0073c
@ -190,6 +190,37 @@ class TestKeyConfigParser:
|
|||||||
"""Make sure the default config contains no deprecated commands."""
|
"""Make sure the default config contains no deprecated commands."""
|
||||||
assert rgx.match(command) is None
|
assert rgx.match(command) is None
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'old, new_expected',
|
||||||
|
[
|
||||||
|
('open -t about:blank', 'open -t'),
|
||||||
|
('open -w about:blank', 'open -w'),
|
||||||
|
('open -b about:blank', 'open -b'),
|
||||||
|
('open about:blank', None),
|
||||||
|
('open -t example.com', None),
|
||||||
|
('download-page', 'download'),
|
||||||
|
('cancel-download', 'download-cancel'),
|
||||||
|
('search ""', 'search'),
|
||||||
|
("search ''", 'search'),
|
||||||
|
('search "foo"', None),
|
||||||
|
('set-cmd-text "foo bar"', 'set-cmd-text foo bar'),
|
||||||
|
("set-cmd-text 'foo bar'", 'set-cmd-text foo bar'),
|
||||||
|
('set-cmd-text foo bar', None),
|
||||||
|
('set-cmd-text "foo bar "', 'set-cmd-text -s foo bar'),
|
||||||
|
("set-cmd-text 'foo bar '", 'set-cmd-text -s foo bar'),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
def test_migrations(self, old, new_expected):
|
||||||
|
"""Make sure deprecated commands get migrated correctly."""
|
||||||
|
if new_expected is None:
|
||||||
|
new_expected = old
|
||||||
|
new = old
|
||||||
|
for rgx, repl in configdata.CHANGED_KEY_COMMANDS:
|
||||||
|
if rgx.match(new):
|
||||||
|
new = rgx.sub(repl, new)
|
||||||
|
break
|
||||||
|
assert new == new_expected
|
||||||
|
|
||||||
|
|
||||||
class TestDefaultConfig:
|
class TestDefaultConfig:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user