add a script to make it easy to endorse test output

Invoke it on the "out" file and it's moved to the correct "exp" file,
ready to git add & git commit.
This commit is contained in:
Jeff Epler 2023-08-18 12:27:49 -05:00
parent ca057618ff
commit 100de9e5b9
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 15 additions and 0 deletions

15
tests/endorse.py Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
import os
import sys
import pathlib
for f in sys.argv[1:]:
if not f.endswith(".out"):
print(f"{f}:0: Not a .out file")
continue
p = pathlib.Path(f).stem
a, _, b = p.partition("_")
print(a, b)
p = pathlib.Path(a) / (b + ".exp")
print(f"{p}: Updating expected result from {f}")
os.rename(f, p)