Chromium Code Reviews| 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); |