[MINOR] Shorten reference test filenames (#221)

Chris Mckay 6 years ago committed by GitHub
parent a1e6adfcba
commit eebb2311cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      ethereum/core/build.gradle

@ -80,20 +80,8 @@ def generateTestFiles(FileTree jsonPath, File resourcesPath, File templateFile,
// This is how many json files to include in each test file // This is how many json files to include in each test file
def fileSets = jsonPath.getFiles().collate(5) def fileSets = jsonPath.getFiles().collate(5)
fileSets.each { fileSet -> fileSets.eachWithIndex { fileSet, idx ->
def resPath = resourcesPath.getPath().replaceAll("\\\\", "/") def resPath = resourcesPath.getPath().replaceAll("\\\\", "/")
def name = fileSet
.find({ !it.getName().toString().startsWith(".")})
.getPath()
.toString()
.replaceAll("\\\\", "/")
.replaceAll(resPath + "/", "")
.replaceAll(pathstrip, "")
.replaceAll(".json", "")
.replaceAll("/", "_")
.replaceAll("\\^", "")
.replaceAll("\\-", "")
.replaceAll("\\+", "")
def paths = [] def paths = []
fileSet.each { testJsonFile -> fileSet.each { testJsonFile ->
@ -103,13 +91,13 @@ def generateTestFiles(FileTree jsonPath, File resourcesPath, File templateFile,
} }
} }
def testFile = file(destination + "/" + namePrefix + "_" + name + ".java") def testFile = file(destination + "/" + namePrefix + "_" + idx + ".java")
def allPaths = '"' + paths.join('", "') + '"'; def allPaths = '"' + paths.join('", "') + '"';
def testFileContents = referenceTestTemplate def testFileContents = referenceTestTemplate
.replaceAll("%%TESTS_FILE%%", allPaths) .replaceAll("%%TESTS_FILE%%", allPaths)
.replaceAll("%%TESTS_NAME%%", namePrefix + "_" + name) .replaceAll("%%TESTS_NAME%%", namePrefix + "_" + idx)
testFile.newWriter().withWriter { w -> w << testFileContents } testFile.newWriter().withWriter { w -> w << testFileContents }
} }
} }

Loading…
Cancel
Save