Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[MINOR] Shorten reference test filenames #221

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions ethereum/core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,8 @@ def generateTestFiles(FileTree jsonPath, File resourcesPath, File templateFile,
// This is how many json files to include in each test file
def fileSets = jsonPath.getFiles().collate(5)

fileSets.each { fileSet ->
fileSets.eachWithIndex { fileSet, idx ->
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 = []
fileSet.each { testJsonFile ->
Expand All @@ -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 testFileContents = referenceTestTemplate
.replaceAll("%%TESTS_FILE%%", allPaths)
.replaceAll("%%TESTS_NAME%%", namePrefix + "_" + name)
.replaceAll("%%TESTS_NAME%%", namePrefix + "_" + idx)
testFile.newWriter().withWriter { w -> w << testFileContents }
}
}
Expand Down