Skip to content

Fix #5743: Add check files to neg tests #5852

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

Merged
merged 4 commits into from
Feb 8, 2019

Conversation

nicolasstucki
Copy link
Contributor

The check files contain the error messages positions and messages. Warnings can be checked using tests/neg-custom-args/fatal-warnings.

The check files contains the error messages positions and messages
@nicolasstucki
Copy link
Contributor Author

Note that I did not print the position with the classical format to not loose the point information the difference between [...] and <...> positions.

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

Otherwise, LGTM

if (file.isDirectory) Nil
else {
val checkFile = new JFile(file.getAbsolutePath.reverse.dropWhile(_ != '.').reverse + "check")
checkFileTest(testSource.title, checkFile, reporterOutputLines(reporter))
Copy link
Contributor

Choose a reason for hiding this comment

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

reporterOutputLines will give you all the errors reported but you only want the errors from the current file, right?

Let's say you have files A.scala, B.scala, A.check and B.check, I suspect this will not work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, if there are multiple files, the check file will be on the directory of the test. Just like for run and pos tests. I will make sure that the order of error outputs is stable.

val (compilerCrashed, expectedErrors, actualErrors, hasMissingAnnotations, errorMap) = testSource match {
case testSource @ JointCompilationSource(_, files, flags, outDir, fromTasty, decompilation) =>
val sourceFiles = testSource.sourceFiles
val (errorMap, expectedErrors) = getErrorMapAndExpectedCount(sourceFiles)
val reporter = compile(sourceFiles, flags, true, outDir)
val actualErrors = reporter.errorCount

files.foreach { file =>
Copy link
Contributor

Choose a reason for hiding this comment

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

sourceFiles? => no special case for directory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is the way it works for pos and run tests.

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@liufengyun
Copy link
Contributor

@allanrenucci Merging now to shorten the PR queue. Please feel free to leave more comments and we can address in a later PR.

@liufengyun liufengyun merged commit 3e6fc39 into scala:master Feb 8, 2019
@liufengyun liufengyun deleted the fix-#5743 branch February 8, 2019 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants