Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix false positives in testkit #480

Merged
merged 2 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ object Patch {
case _: LintPatch => hasLintMessage = true
case _ => onlyLint = false
}
hasLintMessage && onlyLint
patch.isEmpty || hasLintMessage && onlyLint
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote an empty syntactic rule and I ran the SemanticSuite. It complained it was missing an output. This is because it checks if there are lint messages. It's obviously not the best way to fix this.

}

private def foreach(patch: Patch)(f: Patch => Unit): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,24 +353,41 @@ object AssertDiff {
.to[IndexedSeq])
.to[IndexedSeq]

val matrix =
new Matrix(
array = data,
rows = expectedLintMessages.size - 1,
columns = reportedLintMessages.size - 1
)
if (reportedLintMessages.nonEmpty && expectedLintMessages.nonEmpty) {
val matrix =
new Matrix(
array = data,
rows = expectedLintMessages.size - 1,
columns = reportedLintMessages.size - 1
)

AssertDiff(
unreported = matrix.rows
.filter(_.forall(_.isWrong))
.flatMap(_.headOption.map(_.assert))
.toList,
unexpected = matrix.columns
.filter(_.forall(_.isWrong))
.flatMap(_.headOption.map(_.lintMessage))
.toList,
missmatch = matrix.cells.filter(_.isMismatch).toList
)
val unreported =
matrix.rows
.filter(_.forall(_.isWrong))
.flatMap(_.headOption.map(_.assert))
.toList

val unexpected =
matrix.columns
.filter(_.forall(_.isWrong))
.flatMap(_.headOption.map(_.lintMessage))
.toList

val missmatch =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mismatch

matrix.cells.filter(_.isMismatch).toList

AssertDiff(
unreported = unreported,
unexpected = unexpected,
missmatch = missmatch
)
} else {
AssertDiff(
unreported = expectedLintMessages,
unexpected = reportedLintMessages,
missmatch = List()
)
}
}
}

Expand Down