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_common.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_common.py')
-rw-r--r-- | test/test_common.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/test_common.py b/test/test_common.py index d7bc2b8b..b6560fc9 100644 --- a/test/test_common.py +++ b/test/test_common.py @@ -11,7 +11,7 @@ from poezio.common import (_datetime_tuple as datetime_tuple, get_utc_time, get_local_time, shell_split, _find_argument_quoted as find_argument_quoted, _find_argument_unquoted as find_argument_unquoted, parse_str_to_secs, - parse_secs_to_str, safeJID) + parse_secs_to_str, safeJID, unique_prefix_of) def test_utc_time(): delta = timedelta(seconds=-3600) @@ -63,3 +63,22 @@ def test_parse_secs_to_str(): def test_safeJID(): assert safeJID('toto@titi/tata') == JID('toto@titi/tata') assert safeJID('toto@…') == JID('') + +def test_unique_prefix_of__no_shared_prefix(): + assert unique_prefix_of("a", "b") == "a" + assert unique_prefix_of("foo", "bar") == "f" + assert unique_prefix_of("foo", "") == "f" + +def test_unique_prefix_of__equal(): + assert unique_prefix_of("foo", "foo") == "foo" + +def test_unique_prefix_of__a_prefix(): + assert unique_prefix_of("foo", "foobar") == "foo" + +def test_unique_prefix_of__b_prefix(): + assert unique_prefix_of("foobar", "foo") == "foob" + +def test_unique_prefix_of__normal_shared_prefix(): + assert unique_prefix_of("foobar", "foobaz") == "foobar" + assert unique_prefix_of("fnord", "funky") == "fn" + assert unique_prefix_of("asbestos", "aspergers") == "asb" |