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

Commit

Permalink
[MINOR] Shorten reference test filenames (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
Errorific authored Oct 31, 2018
1 parent a1e6adf commit eebb231
Showing 1 changed file with 3 additions and 15 deletions.
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

0 comments on commit eebb231

Please sign in to comment.