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

Function extract_test_cases

scripts/isolate_tests.py:16–37  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

14from textwrap import indent, dedent
15
16def extract_test_cases(path):
17 with open(path, encoding="utf8", errors='ignore', mode='r', newline='') as file:
18 lines = file.read().splitlines()
19
20 inside = False
21 delimiter = ''
22 tests = []
23
24 for l in lines:
25 if inside:
26 if l.strip().endswith(')' + delimiter + '";'):
27 inside = False
28 else:
29 tests[-1] += l + '\n'
30 else:
31 m = re.search(r'R"([^(]*)\($', l.strip())
32 if m:
33 inside = True
34 delimiter = m.group(1)
35 tests += ['']
36
37 return tests
38
39def extract_solidity_docs_cases(path):
40 tests = extract_docs_cases(path, [".. code-block:: solidity", '::'])

Callers 1

extract_and_writeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected