X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=test%2Fintegration%2Ftestlib%2Fcheck.py;h=a82e0e439bcaf9473322f5d80b0b65d79e6fc7b4;hb=7bc1936eded0367aab1a4b9a393ccfd74ab110f7;hp=524ca623f949bb86274271a67d9b17f8115ea6d5;hpb=38be602754aab531c47bc1b04e71952dfa8abcf5;p=tinc diff --git a/test/integration/testlib/check.py b/test/integration/testlib/check.py index 524ca623..a82e0e43 100755 --- a/test/integration/testlib/check.py +++ b/test/integration/testlib/check.py @@ -52,6 +52,13 @@ def in_range(value: Num, gte: Num, lte: Num) -> None: 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: