Skip to content

Commit 9153f95

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 6afea4b commit 9153f95

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
@@ -771,7 +771,7 @@ def startswith(self, prefix: str) -> bool:
771771
return self.output.startswith(prefix)
772772

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

776776
def __eq__(self, expected: object) -> bool:
777777
"""
@@ -786,7 +786,7 @@ def __eq__(self, expected: object) -> bool:
786786
return False
787787
else:
788788
expiter = expected
789-
return self._items() == expiter
789+
return self._items() == sorted(expiter)
790790

791791
def __contains__(self, item: str) -> bool:
792792
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
@@ -38,7 +38,10 @@ def test_5_brace(self, bash, functions):
3838

3939
def test_6_glob(self, bash, functions):
4040
output = assert_bash_exec(bash, "__tester 'a?b'", want_output=True)
41-
assert output.strip() == "<a b><a$b><a&b><a'b>"
41+
assert (
42+
"><".join(sorted(output.strip().split("><")))
43+
== "<a b><a$b><a&b><a'b>"
44+
)
4245

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

0 commit comments

Comments
 (0)