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

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

Issue 1573203003: Compute public namespace during resynthesizing. (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 2ea78c676c3f0f735b2d6f7bb81e8b18ea625659..20cce13404a1489ebb72f20e3030134331cce123 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -6,6 +6,7 @@ library test.src.serialization.elements_test;
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/resolver.dart' show Namespace;
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/summary/format.dart';
import 'package:analyzer/src/summary/resynthesize.dart';
@@ -70,8 +71,9 @@ class ResynthTest extends ResolverTestCase {
compareFunctionElements(
resynthesized.entryPoint, original.entryPoint, '(entry point)');
}
- // TODO(paulberry): test exportNamespace, publicNamespace,
- // and metadata.
+ compareNamespaces(resynthesized.publicNamespace, original.publicNamespace,
+ '(public namespace)');
+ // TODO(paulberry): test exportNamespace and metadata.
}
void compareClassElements(
@@ -316,6 +318,18 @@ class ResynthTest extends ResolverTestCase {
}
}
+ void compareNamespaces(
+ Namespace resynthesized, Namespace original, String desc) {
+ Map<String, Element> resynthesizedMap = resynthesized.definedNames;
+ Map<String, Element> originalMap = original.definedNames;
+ expect(resynthesizedMap.keys, originalMap.keys, reason: desc);
Paul Berry 2016/01/11 22:27:24 I'd rather not rely on the keys being in the same
+ for (String key in originalMap.keys) {
+ Element resynthesizedElement = resynthesizedMap[key];
+ Element originalElement = originalMap[key];
+ compareElements(resynthesizedElement, originalElement, key);
+ }
+ }
+
void compareParameterElements(ParameterElementImpl resynthesized,
ParameterElementImpl original, String desc) {
compareVariableElements(resynthesized, original, desc);
« 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