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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_ast_test.dart

Issue 2527453002: Respect the "allowErrors" parameter in _ResynthesizeAstTest.checkLibrary. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.src.summary.resynthesize_ast_test; 5 library analyzer.test.src.summary.resynthesize_ast_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/error/error.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 10 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/generated/engine.dart' 11 import 'package:analyzer/src/generated/engine.dart'
11 show AnalysisContext, AnalysisOptionsImpl; 12 show AnalysisContext, AnalysisOptionsImpl;
12 import 'package:analyzer/src/generated/sdk.dart'; 13 import 'package:analyzer/src/generated/sdk.dart';
13 import 'package:analyzer/src/generated/source.dart'; 14 import 'package:analyzer/src/generated/source.dart';
14 import 'package:analyzer/src/summary/format.dart'; 15 import 'package:analyzer/src/summary/format.dart';
15 import 'package:analyzer/src/summary/idl.dart'; 16 import 'package:analyzer/src/summary/idl.dart';
16 import 'package:analyzer/src/summary/link.dart'; 17 import 'package:analyzer/src/summary/link.dart';
17 import 'package:analyzer/src/summary/prelink.dart'; 18 import 'package:analyzer/src/summary/prelink.dart';
18 import 'package:analyzer/src/summary/resynthesize.dart'; 19 import 'package:analyzer/src/summary/resynthesize.dart';
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 875 }
875 876
876 abstract class _ResynthesizeAstTest extends ResynthesizeTest 877 abstract class _ResynthesizeAstTest extends ResynthesizeTest
877 with _AstResynthesizeTestMixin { 878 with _AstResynthesizeTestMixin {
878 @override 879 @override
879 LibraryElementImpl checkLibrary(String text, 880 LibraryElementImpl checkLibrary(String text,
880 {bool allowErrors: false, bool dumpSummaries: false}) { 881 {bool allowErrors: false, bool dumpSummaries: false}) {
881 Source source = addTestSource(text); 882 Source source = addTestSource(text);
882 LibraryElementImpl resynthesized = _encodeDecodeLibraryElement(source); 883 LibraryElementImpl resynthesized = _encodeDecodeLibraryElement(source);
883 LibraryElementImpl original = context.computeLibraryElement(source); 884 LibraryElementImpl original = context.computeLibraryElement(source);
885 if (!allowErrors) {
886 List<AnalysisError> errors = context.computeErrors(source);
887 if (errors.isNotEmpty) {
888 fail('Analysis errors: $errors');
889 }
890 }
884 checkLibraryElements(original, resynthesized); 891 checkLibraryElements(original, resynthesized);
885 return resynthesized; 892 return resynthesized;
886 } 893 }
887 894
888 @override 895 @override
889 void compareLocalElementsOfExecutable(ExecutableElement resynthesized, 896 void compareLocalElementsOfExecutable(ExecutableElement resynthesized,
890 ExecutableElement original, String desc) { 897 ExecutableElement original, String desc) {
891 // We don't resynthesize local elements during link. 898 // We don't resynthesize local elements during link.
892 // So, we should not compare them. 899 // So, we should not compare them.
893 } 900 }
894 901
895 @override 902 @override
896 DartSdk createDartSdk() => AbstractContextTest.SHARED_MOCK_SDK; 903 DartSdk createDartSdk() => AbstractContextTest.SHARED_MOCK_SDK;
897 904
898 @override 905 @override
899 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) { 906 TestSummaryResynthesizer encodeDecodeLibrarySource(Source source) {
900 return _encodeLibrary(source); 907 return _encodeLibrary(source);
901 } 908 }
902 } 909 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698