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 7ff458dc35c45e156fc6349b61c2dc28f5af1a21..89a57779efba07085c202ea85a4d0069f821d61e 100644 |
| --- a/pkg/analyzer/test/src/summary/resynthesize_test.dart |
| +++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart |
| @@ -599,7 +599,9 @@ class ResynthTest extends ResolverTestCase { |
| VariableElementImpl original, String desc) { |
| compareElements(resynthesized, original, desc); |
| compareTypes(resynthesized.type, original.type, desc); |
| - if (shouldCompareConstValues) { |
| + // TODO(scheglov) implement and validate other constant variable types |
| + if (shouldCompareConstValues && |
| + original is ConstTopLevelVariableElementImpl) { |
| compareConstantExpressions(resynthesized.constantInitializer, |
| original.constantInitializer, desc); |
| } |
| @@ -1006,6 +1008,55 @@ class E {}'''); |
| checkLibrary('class C {} class D {}'); |
| } |
| + test_const_reference_type() { |
|
Paul Berry
2016/01/31 13:41:02
There should be a test case for the problem mentio
scheglov
2016/01/31 18:55:29
Done.
|
| + shouldCompareConstValues = true; |
| + checkLibrary(r''' |
| +class C {} |
| +enum E {a, b, c} |
| +typedef F(int a, String b); |
| +const vDynamic = dynamic; |
| +const vNull = Null; |
| +const vObject = Object; |
| +const vClass = C; |
| +const vEnum = E; |
| +const vFunctionTypeAlias = F; |
| +'''); |
| + } |
| + |
| + test_const_reference_type_imported() { |
| + shouldCompareConstValues = true; |
| + addLibrarySource( |
| + '/a.dart', |
| + r''' |
| +class C {} |
| +enum E {a, b, c} |
| +typedef F(int a, String b); |
| +'''); |
| + checkLibrary(r''' |
| +import 'a.dart'; |
| +const vClass = C; |
| +const vEnum = E; |
| +const vFunctionTypeAlias = F; |
| +'''); |
| + } |
| + |
| + test_const_reference_type_imported_withPrefix() { |
| + shouldCompareConstValues = true; |
| + addLibrarySource( |
| + '/a.dart', |
| + r''' |
| +class C {} |
| +enum E {a, b, c} |
| +typedef F(int a, String b); |
| +'''); |
| + checkLibrary(r''' |
| +import 'a.dart' as p; |
| +const vClass = p.C; |
| +const vEnum = p.E; |
| +const vFunctionTypeAlias = p.F; |
| +'''); |
| + } |
| + |
| test_const_topLevel_binary() { |
| shouldCompareConstValues = true; |
| checkLibrary(r''' |