From 8d424848639cc848968969571ddeeb2ea3fc3303 Mon Sep 17 00:00:00 2001 From: Boyan Date: Sat, 7 Dec 2024 09:49:35 +0100 Subject: [PATCH] Added conditional temmies support --- ucompile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ucompile b/ucompile index d06645b..86e7a58 100755 --- a/ucompile +++ b/ucompile @@ -25,6 +25,7 @@ def run_input_cases(program, args): input_files = sorted(glob(os.path.join(tests_dir, "*.in")), key=os.path.getmtime) + passed = True if len(input_files) < 1: if time_flag: start_time = time.perf_counter() @@ -96,6 +97,7 @@ def run_input_cases(program, args): if program_output == expected_output: print("✅") else: + passed = False print("❌") # green expected output and red program output print(f"{Fore.GREEN}Expected output:{Style.RESET_ALL}") @@ -118,7 +120,7 @@ def run_input_cases(program, args): print(f"⏳: {elapsed_time:.4f} s") print("-----------") - return + return failed def python_compile(file_name, args): @@ -213,7 +215,13 @@ def main(): args.tests_dir = args.tests if args.tests else "." - SUPPORTED_LANGS[file_ext](file_name, args) + if not SUPPORTED_LANGS[file_ext](file_name, args) # don't do submit dialogue if failed + return + + temmies_check = os.path.join(os.path.dirname(file_name), ".temmies") + if os.path.exists(temmies_check): + if input("Would you like to submit? (y/N): ") == "y": + os.system("temmies submit") return