diff options
author | chriseth <chris@ethereum.org> | 2016-10-12 21:20:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-12 21:20:32 +0800 |
commit | def3f3ea46479063f44d94e75f46b9dcb249c101 (patch) | |
tree | d5ee6834b76f2d326536aa8767ee18e2674aec25 /scripts | |
parent | 48ac9706770f72fe95848656147131c4ea644a77 (diff) | |
parent | ff18c7404a6ecbfb72569fd66a74674083b70b0a (diff) | |
download | dexon-solidity-def3f3ea46479063f44d94e75f46b9dcb249c101.tar dexon-solidity-def3f3ea46479063f44d94e75f46b9dcb249c101.tar.gz dexon-solidity-def3f3ea46479063f44d94e75f46b9dcb249c101.tar.bz2 dexon-solidity-def3f3ea46479063f44d94e75f46b9dcb249c101.tar.lz dexon-solidity-def3f3ea46479063f44d94e75f46b9dcb249c101.tar.xz dexon-solidity-def3f3ea46479063f44d94e75f46b9dcb249c101.tar.zst dexon-solidity-def3f3ea46479063f44d94e75f46b9dcb249c101.zip |
Merge pull request #1126 from ethereum/isolateTests
Add script to extract test cases.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/isolateTests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/isolateTests.py b/scripts/isolateTests.py new file mode 100755 index 00000000..fed779d3 --- /dev/null +++ b/scripts/isolateTests.py @@ -0,0 +1,24 @@ +#!/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 as +# scripts/isolateTests.py tests/libsolidity/SolidityEndToEndTest.cpp + +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]) |