| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:convert'; | 5 import 'dart:convert'; |
| 6 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow | 6 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow |
| 7 // CommandOutput.exitCode in subclasses of CommandOutput. | 7 // CommandOutput.exitCode in subclasses of CommandOutput. |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:status_file/expectation.dart'; | 10 import 'package:status_file/expectation.dart'; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 bool get canRunDependendCommands { | 78 bool get canRunDependendCommands { |
| 79 // FIXME(kustermann): We may need to change this | 79 // FIXME(kustermann): We may need to change this |
| 80 return !hasTimedOut && exitCode == 0; | 80 return !hasTimedOut && exitCode == 0; |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool get successful { | 83 bool get successful { |
| 84 // FIXME(kustermann): We may need to change this | 84 // FIXME(kustermann): We may need to change this |
| 85 return !hasTimedOut && exitCode == 0; | 85 return !hasTimedOut && exitCode == 0; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // TODO(bob): Remove. | |
| 89 // Reverse result of a negative test. | 88 // Reverse result of a negative test. |
| 90 bool hasFailed(TestCase testCase) { | 89 bool hasFailed(TestCase testCase) { |
| 91 return testCase.isNegative ? !_didFail(testCase) : _didFail(testCase); | 90 return testCase.isNegative ? !_didFail(testCase) : _didFail(testCase); |
| 92 } | 91 } |
| 93 | 92 |
| 94 bool get hasNonUtf8 => exitCode == nonUtfFakeExitCode; | 93 bool get hasNonUtf8 => exitCode == nonUtfFakeExitCode; |
| 95 | 94 |
| 96 Expectation _negateOutcomeIfNegativeTest( | 95 Expectation _negateOutcomeIfNegativeTest( |
| 97 Expectation outcome, bool isNegative) { | 96 Expectation outcome, bool isNegative) { |
| 98 if (!isNegative) return outcome; | 97 if (!isNegative) return outcome; |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 if (hasTimedOut) return Expectation.timeout; | 715 if (hasTimedOut) return Expectation.timeout; |
| 717 if (hasNonUtf8) return Expectation.nonUtf8Error; | 716 if (hasNonUtf8) return Expectation.nonUtf8Error; |
| 718 | 717 |
| 719 // Handle errors / missing errors | 718 // Handle errors / missing errors |
| 720 if (testCase.expectCompileError) { | 719 if (testCase.expectCompileError) { |
| 721 return exitCode == 0 | 720 return exitCode == 0 |
| 722 ? Expectation.missingCompileTimeError | 721 ? Expectation.missingCompileTimeError |
| 723 : Expectation.pass; | 722 : Expectation.pass; |
| 724 } | 723 } |
| 725 | 724 |
| 726 // TODO(jmesserly): should we handle `testCase.isNegative`? Analyzer does | 725 var outcome = |
| 727 // not, so this behavior is chosen to match. | 726 exitCode == 0 ? Expectation.pass : Expectation.compileTimeError; |
| 728 return exitCode == 0 ? Expectation.pass : Expectation.compileTimeError; | 727 return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative); |
| 729 } | 728 } |
| 730 } | 729 } |
| 731 | 730 |
| 732 class KernelCompilationCommandOutput extends CompilationCommandOutput { | 731 class KernelCompilationCommandOutput extends CompilationCommandOutput { |
| 733 KernelCompilationCommandOutput( | 732 KernelCompilationCommandOutput( |
| 734 Command command, | 733 Command command, |
| 735 int exitCode, | 734 int exitCode, |
| 736 bool timedOut, | 735 bool timedOut, |
| 737 List<int> stdout, | 736 List<int> stdout, |
| 738 List<int> stderr, | 737 List<int> stderr, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 // complete successfully, it's outcome is Expectation.FAIL. | 864 // complete successfully, it's outcome is Expectation.FAIL. |
| 866 // TODO: maybe we should introduce a AsyncIncomplete marker or so | 865 // TODO: maybe we should introduce a AsyncIncomplete marker or so |
| 867 if (outcome == Expectation.pass) { | 866 if (outcome == Expectation.pass) { |
| 868 if (_isAsyncTest(testOutput) && !_isAsyncTestSuccessful(testOutput)) { | 867 if (_isAsyncTest(testOutput) && !_isAsyncTestSuccessful(testOutput)) { |
| 869 return Expectation.fail; | 868 return Expectation.fail; |
| 870 } | 869 } |
| 871 } | 870 } |
| 872 return outcome; | 871 return outcome; |
| 873 } | 872 } |
| 874 } | 873 } |
| OLD | NEW |