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

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1642993003: Resynthesize untyped List / Map. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Verify constant map keys order. Created 4 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/lib/src/summary/resynthesize.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/src/summary/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index 3038400625543de1ff034047aa17cb06654c76c9..1cc1cda4a7b4d7fe09c0910e01c451145cdfa698 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -222,9 +222,27 @@ class ResynthTest extends ResolverTestCase {
expect(resynthesized.toDoubleValue(), original.toDoubleValue(),
reason: desc);
} else if (original.toListValue() != null) {
- fail('Not implemented');
+ List<DartObject> resynthesizedList = resynthesized.toListValue();
+ List<DartObject> originalList = original.toListValue();
+ expect(resynthesizedList, hasLength(originalList.length));
+ for (int i = 0; i < originalList.length; i++) {
+ compareConstantValues(resynthesizedList[i], originalList[i], desc);
+ }
} else if (original.toMapValue() != null) {
- fail('Not implemented');
+ Map<DartObject, DartObject> resynthesizedMap =
+ resynthesized.toMapValue();
+ Map<DartObject, DartObject> originalMap = original.toMapValue();
+ expect(resynthesizedMap, hasLength(originalMap.length));
+ List<DartObject> resynthesizedKeys = resynthesizedMap.keys.toList();
+ List<DartObject> originalKeys = originalMap.keys.toList();
+ for (int i = 0; i < originalKeys.length; i++) {
+ DartObject resynthesizedKey = resynthesizedKeys[i];
+ DartObject originalKey = originalKeys[i];
+ compareConstantValues(resynthesizedKey, originalKey, desc);
+ DartObject resynthesizedValue = resynthesizedMap[resynthesizedKey];
+ DartObject originalValue = originalMap[originalKey];
+ compareConstantValues(resynthesizedValue, originalValue, desc);
+ }
} else if (original.toStringValue() != null) {
expect(resynthesized.toStringValue(), original.toStringValue(),
reason: desc);
@@ -1017,6 +1035,20 @@ const vComplement = ~1;
''');
}
+ test_const_topLevel_untypedList() {
+ shouldCompareConstValues = true;
+ checkLibrary(r'''
+const v = const [1, 2, 3];
+''');
+ }
+
+ test_const_topLevel_untypedMap() {
+ shouldCompareConstValues = true;
+ checkLibrary(r'''
+const v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'};
+''');
+ }
+
test_constructor_documented() {
checkLibrary('''
class C {
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698