Skip to content

Commit

Permalink
#3643 polished
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 15, 2024
1 parent 7e1e76e commit 2347b19
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 31 deletions.
1 change: 1 addition & 0 deletions .codenarc
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ ruleset {
LoggerWithWrongModifiers
LoggingSwallowsStacktrace
MultipleLoggers
Println
PrintStackTrace
SystemErrPrint
SystemOutPrint
Expand Down
2 changes: 1 addition & 1 deletion eo-maven-plugin/src/it/duplicate_classes/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ boolean disjoint = Files.walk(testClasses).filter(Files::isRegularFile)
.map { path -> testClasses.relativize(path).toString() }
.noneMatch { classPathName -> binaries.contains(classPathName) }

log.info "Compiled classes do not have duplicates: $disjoint"
log.info("Compiled classes do not have duplicates: $disjoint")
assert disjoint
return true
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ content.mojos.mojo.findAll { mojo -> !(mojo.goal.text() in toBeExcluded) }
}
}
if (!failures.empty) {
fail(String.format(
'Following parameters don\'t match pattern %s:%n %s',
pattern,
failures.join(' ')
))
fail("Following parameters don\'t match pattern ${pattern}:\n ${failures.join(' ')}")
}
true
2 changes: 1 addition & 1 deletion eo-maven-plugin/src/test/groovy/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ List<String> tests = [
]
for (test in tests) {
Object res = evaluate folder.resolve(test).toFile()
log.info "Verified with $test - OK. Result: $res"
log.info("Verified with ${test} - OK. Result: ${res}")
}
true
21 changes: 9 additions & 12 deletions eo-runtime/src/test/groovy/check-all-java-classes-compiled.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,30 @@ import java.nio.file.Files
import java.nio.file.Path
import java.util.stream.Collectors

String org = 'org'
String eolang = 'eolang'
String javaExtension = '.java'
String classExtension = '.class'

Path binaries = basedir.toPath()
.resolve('target')
.resolve('classes')
.resolve(org)
.resolve(eolang)
.resolve('org')
.resolve('eolang')
Path classes = basedir.toPath()
.resolve('src')
.resolve('main')
.resolve('java')
.resolve(org)
.resolve(eolang)
.resolve('org')
.resolve('eolang')

Set<String> expected = Files.walk(classes)
.filter(path -> path.toString().endsWith(javaExtension))
.filter(path -> path.toString().endsWith('.java'))
.map(Path::getFileName)
.map(Path::toString)
.map(pathName -> pathName.replace(javaExtension, classExtension))
.map(pathName -> pathName.replace('.java', '.class'))
.collect(Collectors.toSet())
Set<String> actual = Files.walk(binaries)
.filter(path -> path.toString().endsWith(classExtension))
.filter(path -> path.toString().endsWith('.class'))
.map(Path::getFileName)
.map(Path::toString)
.collect(Collectors.toSet())

if (!actual.containsAll(expected)) {
fail("Not all classes are compiled\nExpected ${expected}\nActual ${actual}")
}
1 change: 1 addition & 0 deletions eo-runtime/src/test/groovy/check-folders-numbering.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ for (dir in directories) {
if (!allowedDirs.contains(dir)) {
fail("The directory '${dir.name}' is not expected to be here")
}
log.info("The directory is found: ${dir}")
}
6 changes: 4 additions & 2 deletions eo-runtime/src/test/groovy/check-runtime-deps.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ GPathResult project = new XmlSlurper().parseText(pom)

project.dependencies.dependency.each { dependency ->
if (dependency.scope.text() != 'test' && dependency.scope.text() != 'provided') {
fail("Dependency ${dependency.groupId.text()}.${dependency.artifactId.text()} " +
"must be in either 'test' or 'provided' scope")
fail(
"Dependency ${dependency.groupId.text()}.${dependency.artifactId.text()} " +
"must be in either 'test' or 'provided' scope"
)
}
}
17 changes: 9 additions & 8 deletions src/test/groovy/check-xsl-id.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ import groovy.io.FileVisitResult
File project = new File('.')

project.traverse(
type: FileType.FILES,
preDir: { file ->
if (file.name == 'target') {
return FileVisitResult.SKIP_SUBTREE
}
},
nameFilter: ~/.*\.xsl|xs3p.xsl/,
type: FileType.FILES,
preDir: { file ->
if (file.name == 'target') {
return FileVisitResult.SKIP_SUBTREE
}
},
nameFilter: ~/.*\.xsl|xs3p.xsl/,
) {
file ->
file ->
String id = new XmlSlurper().parse(file).@id
assert id == file.name - '.xsl'
log.info("The XSL stylesheet has correct @id: ${file}")
}
true
4 changes: 2 additions & 2 deletions src/test/groovy/xslqual.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ rules.forEach {
</xsl:template>
</xsl:stylesheet>
""")
println "${warning}:"
log.info("${warning}:")
new File('.').traverse(
type: FileType.FILES,
preDir: { file ->
Expand All @@ -163,7 +163,7 @@ rules.forEach {
com.jcabi.xml.XMLDocument xsl = new com.jcabi.xml.XMLDocument(file)
String ret = check.applyTo(xsl)
if (!ret.empty) {
println " ERROR: ${file} (${ret})"
log.info(" ERROR: ${file} (${ret})")
++errors
}
}
Expand Down

0 comments on commit 2347b19

Please sign in to comment.