mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add script to extract test cases.
This commit is contained in:
parent
c06ba01136
commit
a5810e3793
23
scripts/isolateTests.py
Executable file
23
scripts/isolateTests.py
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
#
|
||||||
|
# This script reads C++ source files and writes all
|
||||||
|
# multi-line strings into individual files.
|
||||||
|
# This can be used to extract the Solidity test cases
|
||||||
|
# into files for e.g. fuzz testing.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
lines = sys.stdin.read().split('\n')
|
||||||
|
inside = False
|
||||||
|
tests = []
|
||||||
|
for l in lines:
|
||||||
|
if inside:
|
||||||
|
if l.strip().endswith(')";'):
|
||||||
|
inside = False
|
||||||
|
else:
|
||||||
|
tests[-1] += l + '\n'
|
||||||
|
else:
|
||||||
|
if l.strip().endswith('R"('):
|
||||||
|
inside = True
|
||||||
|
tests += ['']
|
||||||
|
for i in range(len(tests)):
|
||||||
|
open('test%d.sol' % i, 'w').write(tests[i])
|
Loading…
Reference in New Issue
Block a user