(f, solidityTests, yulTests)
| 101 | return tests |
| 102 | |
| 103 | def write_cases(f, solidityTests, yulTests): |
| 104 | cleaned_filename = f.replace(".","_").replace("-","_").replace(" ","_").lower() |
| 105 | for language, test in [("sol", t) for t in solidityTests] + [("yul", t) for t in yulTests]: |
| 106 | # When code examples are extracted they are indented by 8 spaces, which violates the style guide, |
| 107 | # so before checking remove 4 spaces from each line. |
| 108 | remainder = dedent(test) |
| 109 | source_code_hash = hashlib.sha256(test.encode("utf-8")).hexdigest() |
| 110 | sol_filename = f'test_{source_code_hash}_{cleaned_filename}.{language}' |
| 111 | with open(sol_filename, mode='w', encoding='utf8', newline='') as fi: |
| 112 | fi.write(remainder) |
| 113 | |
| 114 | def extract_and_write(path, language): |
| 115 | assert language in ["solidity", "yul", ""] |
no test coverage detected