Skip to content

Commit

Permalink
make the tests more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed May 17, 2023
1 parent f0fcfd9 commit a8653dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tests/test-cases.nt
Original file line number Diff line number Diff line change
Expand Up @@ -591,10 +591,10 @@ emborg with configs:
magnate:
args: --quiet due
expected:
> test0: (just now|(\d+ )?(seconds|minutes)) since last backup\.
> test1: (just now|(\d+ )?(seconds|minutes)) since last backup\.
> test2: (just now|(\d+ )?(seconds|minutes)) since last backup\.
> test3: (just now|(\d+ )?(seconds|minutes)) since last backup\.
> test0: (just now|(\d+(\.\d)? )?(seconds|minutes)) since last backup\.
> test1: (just now|(\d+(\.\d)? )?(seconds|minutes)) since last backup\.
> test2: (just now|(\d+(\.\d)? )?(seconds|minutes)) since last backup\.
> test3: (just now|(\d+(\.\d)? )?(seconds|minutes)) since last backup\.
expected_type: regex

build:
Expand Down
7 changes: 6 additions & 1 deletion tests/test_emborg.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ def run(self):
if 'regex' in self.expected_type:
matches = bool(re.fullmatch(expected, result))
else:
matches = expected == result
if 'error' in self.expected_type:
# because error messages use wrapping the white space can
# vary, so simply eliminate the white space
matches = expected.split() == result.split()
else:
matches = expected == result

if matches and self.cmp_dirs:
gen_dir, ref_dir = self.cmp_dirs
Expand Down

0 comments on commit a8653dc

Please sign in to comment.