Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Improve Formatting, Take 5
Browse files Browse the repository at this point in the history
  • Loading branch information
aldrinleal committed Sep 21, 2023
1 parent 364654e commit 4cbc8a9
Show file tree
Hide file tree
Showing 4 changed files with 4,134 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,6 @@ class FormatCommand : AbstractCommand() {
companion object {
val LINE_ENDINGS = setOf("\r\n", "\n", "\r")

val RE_EMPTY_ELEMENT = Regex("""<(\p{Alnum}+)></\1>|<(\p{Alnum}+)\s*/>""")
val RE_EMPTY_ELEMENT = Regex("""<([\p{Alnum}\-\.]+)></\1>|<([\p{Alnum}\-\.]+)\s*/>""")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -446,4 +446,32 @@ class POMOperatorTest : AbstractTestBase() {
)
}

@Test
fun testCaseWithEmptyElementFromCustomer() {
val dependencyToUpgrade =
Dependency("io.github.pixee", "java-security-toolkit", version = "1.0.2")

val context = gwt(
"hack23-cia",
ProjectModelFactory.load(
POMOperatorTest::class.java.getResource("pom-hack23-cia.xml")!!,
).withDependency(dependencyToUpgrade).withUseProperties(true)
)

assertTrue(context.pomFile.dirty, "Original POM File is Dirty")

val resultPomAsString = String(context.pomFile.resultPomBytes)

assertTrue(
resultPomAsString.contains("<sonar.zaproxy.reportPath></sonar.zaproxy.reportPath>"),
"There must be an untouched empty element"
)

/*
assertTrue(
resultPomAsString.contains("<mkdir dir=\"\${project.build.directory}/dependency\"></mkdir>"),
"There must be an untouched element with attributes"
)
*/
}
}
Loading

0 comments on commit 4cbc8a9

Please sign in to comment.