Skip to content

Commit b6fb61a

Browse files
committed
test: Sort completion results items
It seems there is some behaviour differences regarding the order completions are returned in between linux and macos, specifically regarding sorting of upper case and lowercase letters. Sorting them ourselves in the tests makes it consistent.
1 parent ab2c339 commit b6fb61a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test/t/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ def startswith(self, prefix: str) -> bool:
773773
return self.output.startswith(prefix)
774774

775775
def _items(self) -> List[str]:
776-
return [x.strip() for x in self.output.strip().splitlines()]
776+
return sorted([x.strip() for x in self.output.strip().splitlines()])
777777

778778
def __eq__(self, expected: object) -> bool:
779779
"""
@@ -788,7 +788,7 @@ def __eq__(self, expected: object) -> bool:
788788
return False
789789
else:
790790
expiter = expected
791-
return self._items() == expiter
791+
return self._items() == sorted(expiter)
792792

793793
def __contains__(self, item: str) -> bool:
794794
return item in self._items()

test/t/unit/test_unit_dequote.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import re
2+
13
import pytest
24

35
from conftest import assert_bash_exec, bash_env_saved
@@ -38,7 +40,8 @@ def test_5_brace(self, bash, functions):
3840

3941
def test_6_glob(self, bash, functions):
4042
output = assert_bash_exec(bash, "__tester 'a?b'", want_output=True)
41-
assert output.strip() == "<a b><a$b><a&b><a'b>"
43+
items = sorted(re.findall(r"<[^>]*>", output))
44+
assert "".join(items) == "<a b><a$b><a&b><a'b>"
4245

4346
def test_7_quote_1(self, bash, functions):
4447
output = assert_bash_exec(

0 commit comments

Comments
 (0)