aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/isolate_tests.py
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-09-06 17:37:44 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-09-07 00:03:38 +0800
commit69673f5a4b9ceb7eb71fc338078ce17145b58685 (patch)
treee803e05eccec092c94b35b464ef592d81054d4e5 /scripts/isolate_tests.py
parentc57a60833d96f9f6a568c3b85b9b6edecee8fe4a (diff)
downloaddexon-solidity-69673f5a4b9ceb7eb71fc338078ce17145b58685.tar.gz
dexon-solidity-69673f5a4b9ceb7eb71fc338078ce17145b58685.tar.zst
dexon-solidity-69673f5a4b9ceb7eb71fc338078ce17145b58685.zip
Include origin filename in the filenames generated by isolate_tests.py.
Diffstat (limited to 'scripts/isolate_tests.py')
-rwxr-xr-xscripts/isolate_tests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/isolate_tests.py b/scripts/isolate_tests.py
index 06e9f9ea..8a9aa0a7 100755
--- a/scripts/isolate_tests.py
+++ b/scripts/isolate_tests.py
@@ -56,9 +56,10 @@ def extract_docs_cases(path):
if re.search(r'^ [ ]*(pragma solidity|contract |library |interface )', test, re.MULTILINE)
]
-def write_cases(tests):
+def write_cases(f, tests):
+ cleaned_filename = f.replace(".","_").replace("-","_").replace(" ","_").lower()
for test in tests:
- open('test_%s.sol' % hashlib.sha256(test).hexdigest(), 'wb').write(test)
+ open('test_%s_%s.sol' % (hashlib.sha256(test).hexdigest(), cleaned_filename), 'wb').write(test)
def extract_and_write(f, path):
@@ -69,7 +70,7 @@ def extract_and_write(f, path):
cases = [open(path, 'r').read()]
else:
cases = extract_test_cases(path)
- write_cases(cases)
+ write_cases(f, cases)
if __name__ == '__main__':
path = sys.argv[1]