mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-20 18:48:13 +08:00
Fix test assertion
Make sure to normalize the content that's read from disk to ensure to adapt any platform-specific characters. Closes gh-247
This commit is contained in:
@@ -38,14 +38,14 @@ class SourceCodeAssert {
|
|||||||
|
|
||||||
SourceCodeAssert(String name, String content) {
|
SourceCodeAssert(String name, String content) {
|
||||||
this.name = name
|
this.name = name
|
||||||
this.content = content
|
this.content = content.normalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceCodeAssert equalsTo(Resource expected) {
|
SourceCodeAssert equalsTo(Resource expected) {
|
||||||
def stream = expected.inputStream
|
def stream = expected.inputStream
|
||||||
try {
|
try {
|
||||||
String expectedContent = StreamUtils.copyToString(stream, Charset.forName('UTF-8'))
|
String expectedContent = StreamUtils.copyToString(stream, Charset.forName('UTF-8'))
|
||||||
assertEquals "Unexpected content for $name", expectedContent, content
|
assertEquals "Unexpected content for $name", expectedContent.normalize(), content
|
||||||
} finally {
|
} finally {
|
||||||
stream.close()
|
stream.close()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user