Normalize captures in tree dump

This commit is contained in:
Clément Fournier
2020-08-23 20:28:09 +02:00
parent fd3de437b3
commit d5445d7ea5
4 changed files with 255 additions and 230 deletions

View File

@@ -38,7 +38,7 @@ open class RelevantAttributePrinter : BaseNodeAttributePrinter() {
*/
open class BaseNodeAttributePrinter : TextTreeRenderer(true, -1) {
data class AttributeInfo(val name: String, val value: String?)
data class AttributeInfo(val name: String, val value: Any?)
protected open fun ignoreAttribute(node: Node, attribute: Attribute): Boolean = true

View File

@@ -67,6 +67,12 @@ abstract class BaseTextComparisonTest {
return sourceText
}
protected open fun String.normalize() = replace(
// \R on java 8+
regex = Regex("\\u000D\\u000A|[\\u000A\\u000B\\u000C\\u000D\\u0085\\u2028\\u2029]"),
replacement = "\n"
)
// Outputting a path makes for better error messages
private val srcTestResources = let {
// this is set from maven surefire
@@ -90,11 +96,6 @@ abstract class BaseTextComparisonTest {
companion object {
const val ExpectedExt = ".txt"
fun String.normalize() = replace(
// \R on java 8+
regex = Regex("\\u000D\\u000A|[\\u000A\\u000B\\u000C\\u000D\\u0085\\u2028\\u2029]"),
replacement = "\n"
)
}
}