diff options
author | mathieui <mathieui@mathieui.net> | 2020-05-12 22:32:50 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2020-05-12 22:32:50 +0200 |
commit | ef38ff8f6a7ef813a6b4ab9edad458b4b7e9941f (patch) | |
tree | 70763f4128c9250b4b7ead7e5a8dcc989ae7c8fb /test/test_tabs.py | |
parent | 1b974d2d9aec5c20d3111d208a24d7d67ab6b7de (diff) | |
parent | 1e7ce43789aae67fcfbb4b6fbe49a299fda1cfa1 (diff) | |
download | poezio-ef38ff8f6a7ef813a6b4ab9edad458b4b7e9941f.tar.gz poezio-ef38ff8f6a7ef813a6b4ab9edad458b4b7e9941f.tar.bz2 poezio-ef38ff8f6a7ef813a6b4ab9edad458b4b7e9941f.tar.xz poezio-ef38ff8f6a7ef813a6b4ab9edad458b4b7e9941f.zip |
Merge branch 'feature/unique-prefix-tab-names' into 'master'
Unique prefix tab names
Closes #3525
See merge request poezio/poezio!94
Diffstat (limited to 'test/test_tabs.py')
-rw-r--r-- | test/test_tabs.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test_tabs.py b/test/test_tabs.py index 0a6930d4..6989bd67 100644 --- a/test/test_tabs.py +++ b/test/test_tabs.py @@ -183,3 +183,25 @@ def test_slice(): tabs.append(dummy3) assert tabs[1:2][0] is dummy2 + +def test_find_by_unique_prefix(): + DummyTab.reset() + tabs = Tabs(h) + t1 = DummyTab() + t2 = DummyTab() + t3 = DummyTab() + tabs.append(t1) + tabs.append(t2) + tabs.append(t3) + + t1.name = "foo" + t2.name = "bar" + t3.name = "fnord" + + assert tabs.find_by_unique_prefix("f") == (True, None) + assert tabs.find_by_unique_prefix("b") == (True, t2) + assert tabs.find_by_unique_prefix("fo") == (True, t1) + assert tabs.find_by_unique_prefix("fn") == (True, t3) + assert tabs.find_by_unique_prefix("fx") == (False, None) + assert tabs.find_by_unique_prefix("x") == (False, None) + assert tabs.find_by_unique_prefix("") == (True, None) |