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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2669863003: Handle invalid URIs in summaries. (Closed)
Patch Set: Remove uri.dart, tweak for summarize_ast_test. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/summary/prelinker_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.driver; 5 library analyzer.test.driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 ''', 878 ''',
879 priority: true); 879 priority: true);
880 880
881 AnalysisResult result = await driver.getResult(testFile); 881 AnalysisResult result = await driver.getResult(testFile);
882 ClassDeclaration c = result.unit.declarations[1] as ClassDeclaration; 882 ClassDeclaration c = result.unit.declarations[1] as ClassDeclaration;
883 Annotation a = c.metadata[0]; 883 Annotation a = c.metadata[0];
884 expect(a.name.name, 'fff'); 884 expect(a.name.name, 'fff');
885 expect(a.name.staticElement, new isInstanceOf<FunctionElement>()); 885 expect(a.name.staticElement, new isInstanceOf<FunctionElement>());
886 } 886 }
887 887
888 test_getResult_invalidUri() async {
889 String content = r'''
890 import '[invalid uri]';
891 import '[invalid uri]:foo.dart';
892 import 'package:aaa/a1.dart';
893 import '[invalid uri]';
894 import '[invalid uri]:foo.dart';
895
896 export '[invalid uri]';
897 export '[invalid uri]:foo.dart';
898 export 'package:aaa/a2.dart';
899 export '[invalid uri]';
900 export '[invalid uri]:foo.dart';
901
902 part '[invalid uri]';
903 part 'a3.dart';
904 part '[invalid uri]';
905 ''';
906 addTestFile(content);
907
908 AnalysisResult result = await driver.getResult(testFile);
909 expect(result.path, testFile);
910 }
911
888 test_getResult_invalidUri_exports_dart() async { 912 test_getResult_invalidUri_exports_dart() async {
889 String content = r''' 913 String content = r'''
890 export 'dart:async'; 914 export 'dart:async';
891 export 'dart:noSuchLib'; 915 export 'dart:noSuchLib';
892 export 'dart:math'; 916 export 'dart:math';
893 '''; 917 ''';
894 addTestFile(content, priority: true); 918 addTestFile(content, priority: true);
895 919
896 AnalysisResult result = await driver.getResult(testFile); 920 AnalysisResult result = await driver.getResult(testFile);
897 expect(result.path, testFile); 921 expect(result.path, testFile);
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1991 * Return the [provider] specific path for the given Posix [path]. 2015 * Return the [provider] specific path for the given Posix [path].
1992 */ 2016 */
1993 String _p(String path) => provider.convertPath(path); 2017 String _p(String path) => provider.convertPath(path);
1994 2018
1995 static String _md5(String content) { 2019 static String _md5(String content) {
1996 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 2020 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
1997 } 2021 }
1998 } 2022 }
1999 2023
2000 class _SourceMock extends TypedMock implements Source {} 2024 class _SourceMock extends TypedMock implements Source {}
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/summary/prelinker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698