projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CI: add checks for basic compatibility with muon
[tinc]
/
test
/
integration
/
testlib
/
check.py
diff --git
a/test/integration/testlib/check.py
b/test/integration/testlib/check.py
index
524ca62
..
3b7dec1
100755
(executable)
--- a/
test/integration/testlib/check.py
+++ b/
test/integration/testlib/check.py
@@
-10,6
+10,12
@@
Val = T.TypeVar("Val")
Num = T.TypeVar("Num", int, float)
Num = T.TypeVar("Num", int, float)
+def blank(value: T.AnyStr) -> None:
+ """Check that value is an empty or blank string."""
+ if not isinstance(value, str) or value.strip():
+ raise ValueError(f'expected "{value!r}" to be a blank string')
+
+
def false(value: T.Any) -> None:
"""Check that value is falsy."""
if value:
def false(value: T.Any) -> None:
"""Check that value is falsy."""
if value:
@@
-52,6
+58,13
@@
def in_range(value: Num, gte: Num, lte: Num) -> None:
raise ValueError(f"value {value} must be between {gte} and {lte}")
raise ValueError(f"value {value} must be between {gte} and {lte}")
+def lines(text: T.AnyStr, num: int) -> None:
+ """Check that text splits into `num` lines."""
+ rows = text.splitlines()
+ if len(rows) != num:
+ raise ValueError(f"expected {num} lines, got {len(rows)}: {rows}")
+
+
def is_in(needle: Val, *haystacks: T.Container[Val]) -> None:
"""Check that at least one haystack includes needle."""
for haystack in haystacks:
def is_in(needle: Val, *haystacks: T.Container[Val]) -> None:
"""Check that at least one haystack includes needle."""
for haystack in haystacks: