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
language/bad_initializer2_negative_test #14880
Comments
Negative tests are broken by design. The issue with negative tests is that test.py doesn't know if they are supposed to result in a compile-time error, runtime-error, checked-error, etc. It is not possible to say if the analyzer is expected to print errors/warnings on a negative test or not. Consider the following negative test: tests/language/foobar_negative_test.dart In that case, the none-vm and dart2js-d8 configurations will result in a runtime error, but the analyzer doesn't print errors/warnings and that's fine. Because it's not possible to determine what the analyzer is expected to do on a negative test, we ignore the fact that it is a negative test and treat it as a normal test (i.e. for --compiler=dartanalyzer). cc @ricowind. |
Reopening as a test problem. cc @mkustermann. |
If a negative test is causing problems, I normally try to identify the original author and send them a CL to convert it to a multi-test. In multi-tests you can add information about how the test should fail. |
Apologies - I just wanted to make the comment in here, about negative tests not working with analyze-only runs, available to the people working on the new issue #28664, which I could have done better by putting this issue number there. This particular issue can remain closed. The current status of this issue is that the negative tests bad_initializer[1,2]_negative_test are marked as failing in all the status files for analyzer-only or compiler runs. Those lines should have this issue number added. Only if we decide that these failure lines in the status files are unacceptable, would we need to rewrite these as multitests. |
I don't understand this.
Analyzer (is going to) reports the compile-time error, test is negative and fails with "Expected: Pass"?
FAILED: dartanalyzer-none release_ia32 language/bad_initializer2_negative_test
Expected: Pass
Actual: CompileTimeError
CommandOutput[dartanalyzer]:
stderr:
ERROR|COMPILE_TIME_ERROR|REFERENCED_BEFORE_DECLARATION|/Users/scheglov/Source/Dart/dart/tests/language/bad_initializer2_negative_test.dart|14|19|3|Local variables cannot be referenced before they are declared
Command[dartanalyzer]: sdk/bin/dartanalyzer_developer --ignore-unrecognized-flags --show-package-warnings --package-root=xcodebuild/ReleaseIA32/packages/ --machine --no-hints /Users/scheglov/Source/Dart/dart/tests/language/bad_initializer2_negative_test.dart
Took 0:00:00.032000
Short reproduction command (experimental):
python tools/test.py -mrelease -cdartanalyzer -rnone -t240 language/bad_initializer2_negative_test
The text was updated successfully, but these errors were encountered: