diff --git a/ucompile b/ucompile index 5dcc1e2..13dac60 100755 --- a/ucompile +++ b/ucompile @@ -17,7 +17,7 @@ def check_dependencies() -> None: return -def run_input_cases(program, args): +def run_input_cases(program, args) -> bool: verbose = args.verbose output = args.output tests_dir = args.tests_dir if args.tests_dir else "." @@ -97,8 +97,8 @@ def run_input_cases(program, args): if program_output == expected_output: print("✅") else: - passed = False print("❌") + passed = False # green expected output and red program output print(f"{Fore.GREEN}Expected output:{Style.RESET_ALL}") print(expected_output) @@ -123,18 +123,16 @@ def run_input_cases(program, args): return passed -def python_compile(file_name, args): +def python_compile(file_name, args) -> bool: + passed = None try: if os.system("which pypy3 &> /dev/null") == 0: print(f"{Fore.LIGHTMAGENTA_EX}Using pypy3{Style.RESET_ALL}") - run_input_cases("pypy3 " + file_name, args) - return + return run_input_cases("pypy3 " + file_name, args) except Exception: pass print(f"{Fore.MAGENTA}WARNING: pypy3 not found, using python3 instead{Style.RESET_ALL}") - run_input_cases("python3 " + file_name, args) - return - + return run_input_cases("python3 " + file_name, args) def java_compile(file_name, args): if args.alternative: @@ -149,8 +147,7 @@ def java_compile(file_name, args): def haskell_compile(file_name, args): os.system("ghc -O2 " + file_name + " -o program") - run_input_cases("./program", args) - return + return run_input_cases("./program", args) def c_compile(file_name, args): @@ -220,7 +217,7 @@ def main(): 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": + if input("🎉✨ -- Submit? (y/N): ") == "y": os.system("temmies submit") return