Update run-tests.py

multiline-output
drunkendog 2023-09-12 13:49:39 +01:00
parent b2f1c01c79
commit 65980d0191
1 changed files with 3 additions and 3 deletions

View File

@ -7,8 +7,8 @@ import sys
# will break if there are namespace collisions
file_list = [x.rstrip(".cases") for x in glob.glob(f"{os.path.dirname(__file__)}/**/*.cases", recursive=True)]
file_only_list = [os.path.basename(x) for x in file_list]
file_list = glob.glob(f"{os.path.dirname(__file__)}/**/*.cases", recursive=True)
file_only_list = [os.path.basename(x.rstrip(".cases")) for x in file_list]
if sys.platform == "win32":
os.system("color") # enables ANSI escape characters, bug in Python
@ -19,7 +19,7 @@ for file_name in glob.glob("*.c", recursive=False):
if should_continue != "y":
continue
subprocess.run(["gcc", "-std=c11", "-Wall", "-g", file_name], check=True)
with open(next(x for x in file_list if file_name in x)) as f:
with open(next(x for x in file_list if file_name.rstrip(".c") in x)) as f:
to_run = f.read().split("\n\n")
for x in to_run:
return_data = subprocess.run(["./a.out"], input=x[0].rstrip(), capture_output=True).stdout