| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.test_support; | 4 library engine.test_support; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 import 'package:analyzer-experimental/src/generated/java_core.dart'; | 8 import 'package:analyzer-experimental/src/generated/java_core.dart'; |
| 9 import 'package:analyzer-experimental/src/generated/java_engine.dart'; | 9 import 'package:analyzer-experimental/src/generated/java_engine.dart'; |
| 10 import 'package:analyzer-experimental/src/generated/java_junit.dart'; | 10 import 'package:analyzer-experimental/src/generated/java_junit.dart'; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 /** | 83 /** |
| 84 * Assert that the number of errors that have been gathered matches the number
of errors that are | 84 * Assert that the number of errors that have been gathered matches the number
of errors that are |
| 85 * given and that they have the expected error codes. The order in which the e
rrors were gathered | 85 * given and that they have the expected error codes. The order in which the e
rrors were gathered |
| 86 * is ignored. | 86 * is ignored. |
| 87 * @param expectedErrorCodes the error codes of the errors that should have be
en gathered | 87 * @param expectedErrorCodes the error codes of the errors that should have be
en gathered |
| 88 * @throws AssertionFailedError if a different number of errors have been gath
ered than were | 88 * @throws AssertionFailedError if a different number of errors have been gath
ered than were |
| 89 * expected | 89 * expected |
| 90 */ | 90 */ |
| 91 void assertErrors2(List<ErrorCode> expectedErrorCodes) { | 91 void assertErrors2(List<ErrorCode> expectedErrorCodes) { |
| 92 StringBuffer builder = new StringBuffer(); | 92 JavaStringBuilder builder = new JavaStringBuilder(); |
| 93 Map<ErrorCode, int> expectedCounts = new Map<ErrorCode, int>(); | 93 Map<ErrorCode, int> expectedCounts = new Map<ErrorCode, int>(); |
| 94 for (ErrorCode code in expectedErrorCodes) { | 94 for (ErrorCode code in expectedErrorCodes) { |
| 95 int count = expectedCounts[code]; | 95 int count = expectedCounts[code]; |
| 96 if (count == null) { | 96 if (count == null) { |
| 97 count = 1; | 97 count = 1; |
| 98 } else { | 98 } else { |
| 99 count = count + 1; | 99 count = count + 1; |
| 100 } | 100 } |
| 101 expectedCounts[code] = count; | 101 expectedCounts[code] = count; |
| 102 } | 102 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 115 int expectedCount = entry.getValue(); | 115 int expectedCount = entry.getValue(); |
| 116 int actualCount; | 116 int actualCount; |
| 117 List<AnalysisError> list = errorsByCode.remove(code); | 117 List<AnalysisError> list = errorsByCode.remove(code); |
| 118 if (list == null) { | 118 if (list == null) { |
| 119 actualCount = 0; | 119 actualCount = 0; |
| 120 } else { | 120 } else { |
| 121 actualCount = list.length; | 121 actualCount = list.length; |
| 122 } | 122 } |
| 123 if (actualCount != expectedCount) { | 123 if (actualCount != expectedCount) { |
| 124 if (builder.length == 0) { | 124 if (builder.length == 0) { |
| 125 builder.write("Expected "); | 125 builder.append("Expected "); |
| 126 } else { | 126 } else { |
| 127 builder.write("; "); | 127 builder.append("; "); |
| 128 } | 128 } |
| 129 builder.write(expectedCount); | 129 builder.append(expectedCount); |
| 130 builder.write(" errors of type "); | 130 builder.append(" errors of type "); |
| 131 builder.write(code); | 131 builder.append(code); |
| 132 builder.write(", found "); | 132 builder.append(", found "); |
| 133 builder.write(actualCount); | 133 builder.append(actualCount); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet(errors
ByCode)) { | 136 for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet(errors
ByCode)) { |
| 137 ErrorCode code = entry.getKey(); | 137 ErrorCode code = entry.getKey(); |
| 138 List<AnalysisError> actualErrors = entry.getValue(); | 138 List<AnalysisError> actualErrors = entry.getValue(); |
| 139 int actualCount = actualErrors.length; | 139 int actualCount = actualErrors.length; |
| 140 if (builder.length == 0) { | 140 if (builder.length == 0) { |
| 141 builder.write("Expected "); | 141 builder.append("Expected "); |
| 142 } else { | 142 } else { |
| 143 builder.write("; "); | 143 builder.append("; "); |
| 144 } | 144 } |
| 145 builder.write("0 errors of type "); | 145 builder.append("0 errors of type "); |
| 146 builder.write(code); | 146 builder.append(code); |
| 147 builder.write(", found "); | 147 builder.append(", found "); |
| 148 builder.write(actualCount); | 148 builder.append(actualCount); |
| 149 builder.write(" ("); | 149 builder.append(" ("); |
| 150 for (int i = 0; i < actualErrors.length; i++) { | 150 for (int i = 0; i < actualErrors.length; i++) { |
| 151 AnalysisError error = actualErrors[i]; | 151 AnalysisError error = actualErrors[i]; |
| 152 if (i > 0) { | 152 if (i > 0) { |
| 153 builder.write(", "); | 153 builder.append(", "); |
| 154 } | 154 } |
| 155 builder.write(error.offset); | 155 builder.append(error.offset); |
| 156 } | 156 } |
| 157 builder.write(")"); | 157 builder.append(")"); |
| 158 } | 158 } |
| 159 if (builder.length > 0) { | 159 if (builder.length > 0) { |
| 160 JUnitTestCase.fail(builder.toString()); | 160 JUnitTestCase.fail(builder.toString()); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 /** | 163 /** |
| 164 * Assert that the number of errors that have been gathered matches the number
of severities that | 164 * Assert that the number of errors that have been gathered matches the number
of severities that |
| 165 * are given and that there are the same number of errors and warnings as spec
ified by the | 165 * are given and that there are the same number of errors and warnings as spec
ified by the |
| 166 * argument. The order in which the errors were gathered is ignored. | 166 * argument. The order in which the errors were gathered is ignored. |
| 167 * @param expectedSeverities the severities of the errors that should have bee
n gathered | 167 * @param expectedSeverities the severities of the errors that should have bee
n gathered |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 return trampoline(target, arguments[0], arguments[1]); | 652 return trampoline(target, arguments[0], arguments[1]); |
| 653 case 3: | 653 case 3: |
| 654 return trampoline(target, arguments[0], arguments[1], arguments[2]); | 654 return trampoline(target, arguments[0], arguments[1], arguments[2]); |
| 655 case 4: | 655 case 4: |
| 656 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); | 656 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); |
| 657 default: | 657 default: |
| 658 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | 658 throw new IllegalArgumentException("Not implemented for > 4 arguments"); |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 } | 661 } |
| OLD | NEW |