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

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: 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..ead5ed11e8d5d3c33579abbd8f53ede547c17009 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -222,9 +222,21 @@ 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));
+ originalMap.forEach((originalKey, originalValue) {
Paul Berry 2016/01/28 23:43:07 In Dart, maps are ordered, so there are subtle sem
scheglov 2016/01/29 17:07:08 Thanks, I will add better validation. It turned ou
+ DartObject resynthesizedValue = resynthesizedMap[originalKey];
+ compareConstantValues(resynthesizedValue, originalValue, desc);
+ });
} else if (original.toStringValue() != null) {
expect(resynthesized.toStringValue(), original.toStringValue(),
reason: desc);
@@ -1017,6 +1029,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