aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/isolate_tests.py
diff options
context:
space:
mode:
authorFederico Bond <federicobond@gmail.com>2016-12-07 06:21:10 +0800
committerFederico Bond <federicobond@gmail.com>2016-12-07 06:21:10 +0800
commit7a46e15efd13a15788278627fef3394a8fd0e349 (patch)
treed50ce247ed188ba598713375d7d321dc44e65709 /scripts/isolate_tests.py
parent29edf2f4c90a39e843510a61791b42c6898a045d (diff)
downloaddexon-solidity-7a46e15efd13a15788278627fef3394a8fd0e349.tar
dexon-solidity-7a46e15efd13a15788278627fef3394a8fd0e349.tar.gz
dexon-solidity-7a46e15efd13a15788278627fef3394a8fd0e349.tar.bz2
dexon-solidity-7a46e15efd13a15788278627fef3394a8fd0e349.tar.lz
dexon-solidity-7a46e15efd13a15788278627fef3394a8fd0e349.tar.xz
dexon-solidity-7a46e15efd13a15788278627fef3394a8fd0e349.tar.zst
dexon-solidity-7a46e15efd13a15788278627fef3394a8fd0e349.zip
Rename isolateTests.py script to isolate_tests.py
Diffstat (limited to 'scripts/isolate_tests.py')
-rwxr-xr-xscripts/isolate_tests.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/isolate_tests.py b/scripts/isolate_tests.py
new file mode 100755
index 00000000..fed779d3
--- /dev/null
+++ b/scripts/isolate_tests.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])