Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
17655c30
Commit
17655c30
authored
6 years ago
by
Tagir Valeev
Browse files
Options
Download
Email Patches
Plain Diff
snapshot.kt: added debug output to catch the cause of EclipseImlTest sporadic failure
parent
2723cee6
Branches unavailable
Tags unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
platform/testFramework/extensions/src/com/intellij/testFramework/assertions/snapshot.kt
+22
-1
...ons/src/com/intellij/testFramework/assertions/snapshot.kt
with
22 additions
and
1 deletion
+22
-1
platform/testFramework/extensions/src/com/intellij/testFramework/assertions/snapshot.kt
+
22
-
1
View file @
17655c30
...
...
@@ -42,9 +42,30 @@ private class DumpRepresenter : Representer() {
@Throws
(
FileComparisonFailure
::
class
)
fun
compareFileContent
(
actual
:
Any
,
snapshotFile
:
Path
)
{
val
expectedContent
=
StringUtilRt
.
convertLineSeparators
(
snapshotFile
.
readText
().
trimEnd
())
val
rawExpectedText
=
snapshotFile
.
readText
()
val
trimmedExpectedText
=
rawExpectedText
.
trimEnd
()
val
expectedContent
=
StringUtilRt
.
convertLineSeparators
(
trimmedExpectedText
)
val
actualContent
=
if
(
actual
is
String
)
actual
.
trimEnd
()
else
dumpData
(
actual
).
trimEnd
()
if
(
actualContent
!=
expectedContent
)
{
if
(
expectedContent
.
endsWith
(
"\n"
))
{
val
rawTail
=
getTail
(
rawExpectedText
)
val
trimmedTail
=
getTail
(
trimmedExpectedText
)
val
expectedTail
=
getTail
(
expectedContent
)
val
trimAgainTail
=
getTail
(
expectedContent
.
trimEnd
())
println
(
"Strange thing happens: expected content ends with line break, though it was trimmed\n"
+
"Raw content end chars: $rawTail\n"
+
"Trimmed content end chars: $trimmedTail\n"
+
"Expected end chars: $expectedTail\n"
+
"End chars after trimming again: $trimAgainTail\n"
)
}
throw
FileComparisonFailure
(
null
,
expectedContent
,
actualContent
,
snapshotFile
.
toString
())
}
}
private
fun
getTail
(
text
:
String
):
String
{
if
(
text
.
length
<=
4
)
return
"??"
return
text
[
text
.
length
-
4
].
toInt
().
toString
()
+
"."
+
text
[
text
.
length
-
3
].
toInt
().
toString
()
+
"."
+
text
[
text
.
length
-
2
].
toInt
().
toString
()
+
"."
+
text
[
text
.
length
-
1
].
toInt
().
toString
()
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help