Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: pkg/analyzer/test/generated/test_support.dart

Issue 137863002: Issue 8742. Preserve leading line comments during java2dart translation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test for block-style comment translation. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/scanner_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/test_support.dart
diff --git a/pkg/analyzer/test/generated/test_support.dart b/pkg/analyzer/test/generated/test_support.dart
index a68dde3be0ad516cedccc88cdee81f1a96752bda..2e1b72b37cc8be1e0bbc004c0320e62507397f82 100644
--- a/pkg/analyzer/test/generated/test_support.dart
+++ b/pkg/analyzer/test/generated/test_support.dart
@@ -107,9 +107,15 @@ class GatheringErrorListener implements AnalysisErrorListener {
*/
void assertErrors2(List<ErrorCode> expectedErrorCodes) {
JavaStringBuilder builder = new JavaStringBuilder();
+ //
+ // Verify that the expected error codes have a non-empty message.
+ //
for (ErrorCode errorCode in expectedErrorCodes) {
JUnitTestCase.assertFalseMsg("Empty error code message", errorCode.message.isEmpty);
}
+ //
+ // Compute the expected number of each type of error.
+ //
Map<ErrorCode, int> expectedCounts = new Map<ErrorCode, int>();
for (ErrorCode code in expectedErrorCodes) {
int count = expectedCounts[code];
@@ -120,6 +126,9 @@ class GatheringErrorListener implements AnalysisErrorListener {
}
expectedCounts[code] = count;
}
+ //
+ // Compute the actual number of each type of error.
+ //
Map<ErrorCode, List<AnalysisError>> errorsByCode = new Map<ErrorCode, List<AnalysisError>>();
for (AnalysisError error in _errors) {
ErrorCode code = error.errorCode;
@@ -130,6 +139,9 @@ class GatheringErrorListener implements AnalysisErrorListener {
}
list.add(error);
}
+ //
+ // Compare the expected and actual number of each type of error.
+ //
for (MapEntry<ErrorCode, int> entry in getMapEntrySet(expectedCounts)) {
ErrorCode code = entry.getKey();
int expectedCount = entry.getValue();
@@ -153,6 +165,9 @@ class GatheringErrorListener implements AnalysisErrorListener {
builder.append(actualCount);
}
}
+ //
+ // Check that there are no more errors in the actual-errors map, otherwise, record message.
+ //
for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet(errorsByCode)) {
ErrorCode code = entry.getKey();
List<AnalysisError> actualErrors = entry.getValue();
@@ -516,6 +531,7 @@ class EngineTestCase extends JUnitTestCase {
int diffAhead = Math.max(0, diffPos - _PRINT_RANGE);
int diffAfter = Math.min(actual.length, diffPos + _PRINT_RANGE);
String diffStr = "${actual.substring(diffAhead, diffPos)}^${actual.substring(diffPos, diffAfter)}";
+ // use detailed message
String message = "Content not as expected: is\n${actual}\nDiffers at pos ${diffPos}: ${diffStr}\nexpected:\n${expected}";
JUnitTestCase.assertEqualsMsg(message, expected, actual);
}
« no previous file with comments | « pkg/analyzer/test/generated/scanner_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698