MCPcopy Create free account
hub / github.com/argotorg/solidity / write_cases

Function write_cases

scripts/isolate_tests.py:103–112  ·  view source on GitHub ↗
(f, solidityTests, yulTests)

Source from the content-addressed store, hash-verified

101 return tests
102
103def 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
114def extract_and_write(path, language):
115 assert language in ["solidity", "yul", ""]

Callers 1

extract_and_writeFunction · 0.70

Calls 2

replaceMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected