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

Neg tests: remove xerror parameter from neg tests (#1110) #1122

Merged
merged 3 commits into from
Mar 3, 2016

Conversation

VladimirNik
Copy link
Contributor

Neg tests at the moment take expected number of errors as an argument. Since #1106 we can optionally mark lines where errors are expected.

With this change we don't need to pass the expected number of errors as an argument to neg tests anymore. In addition most of the neg files don't require separate test (except for files that should use specific arguments for compilation or directories that should be compiled inside neg dir):

@Test def neg_all = compileFiles(negDir, verbose = true, compileSubDirs = false)

New subfolders in neg dir:

  • compExceptions - contains tests that result in exception during the compilation (currently only structural.scala);
  • customArgs - contains neg tests that should be compiled with specific arguments;

Several files were in neg dir but were not added to tests.scala as tests. Now they became a part of neg_all test:

tests/neg/Main.scala
tests/neg/i827.scala
tests/neg/implicitDefs.scala
tests/neg/t1292.scala
tests/neg/t7278.scala

Several files that were in neg dir have no compilation errors. Now they are moved to pos tests:

tests/neg/patternUnsoundness.scala
tests/neg/t1164.scala

Related issue: #1110
Review by @DarkDimius

(implicit defaultOptions: List[String]): Unit = {
val allArgs = args ++ defaultOptions
val processor = if (allArgs.exists(_.startsWith("#"))) Bench else Main
val reporter = processor.process(allArgs)

val nerrors = reporter.errorCount
val xerrors = (expectedErrorsPerFile map {_.totalErrors}).sum
if (negTest)
assert((negTest && xerrors > 0), s"No errors found in neg test")
Copy link
Contributor

Choose a reason for hiding this comment

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

this if is strange

@VladimirNik
Copy link
Contributor Author

Update: now we don't need negTest flag anymore; neg tests are binded to neg dir (changes are added in dotty-staging@de7e377)

if (!generatePartestFiles || !partestableDir(prefix, dirName, args ++ defaultOptions, xerrors)) {
if (runTest)
log(s"WARNING: run tests can only be run by partest, JUnit just verifies compilation: $prefix$dirName")
val computeFilePathsAndExpErrors = { () =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I see no reason why this should be a val. Make it a def?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in last commit

@odersky
Copy link
Contributor

odersky commented Mar 3, 2016

Otherwise LGTM

odersky added a commit that referenced this pull request Mar 3, 2016
Neg tests: remove xerror parameter from neg tests (#1110)
@odersky odersky merged commit 6f82c22 into scala:master Mar 3, 2016
@allanrenucci allanrenucci deleted the neg-lines-2 branch December 14, 2017 19:24
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