Skip to content

Commit 8074741

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 00f7d90 commit 8074741

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
@@ -776,7 +776,7 @@ def startswith(self, prefix: str) -> bool:
776776
return self.output.startswith(prefix)
777777

778778
def _items(self) -> List[str]:
779-
return [x.strip() for x in self.output.strip().splitlines()]
779+
return sorted([x.strip() for x in self.output.strip().splitlines()])
780780

781781
def __eq__(self, expected: object) -> bool:
782782
"""
@@ -791,7 +791,7 @@ def __eq__(self, expected: object) -> bool:
791791
return False
792792
else:
793793
expiter = expected
794-
return self._items() == expiter
794+
return self._items() == sorted(expiter)
795795

796796
def __contains__(self, item: str) -> bool:
797797
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)