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

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

Issue 2665213003: Encode URIs stored in unlinked summaries to make them Uri.parse() safe. (Closed)
Patch Set: 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
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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 ''', 882 ''',
883 priority: true); 883 priority: true);
884 884
885 AnalysisResult result = await driver.getResult(testFile); 885 AnalysisResult result = await driver.getResult(testFile);
886 ClassDeclaration c = result.unit.declarations[1] as ClassDeclaration; 886 ClassDeclaration c = result.unit.declarations[1] as ClassDeclaration;
887 Annotation a = c.metadata[0]; 887 Annotation a = c.metadata[0];
888 expect(a.name.name, 'fff'); 888 expect(a.name.name, 'fff');
889 expect(a.name.staticElement, new isInstanceOf<FunctionElement>()); 889 expect(a.name.staticElement, new isInstanceOf<FunctionElement>());
890 } 890 }
891 891
892 test_getResult_invalidUri() async {
893 String content = r'''
894 import 'package:aaa/a1.dart';
895 import '[invalid uri]';
896
897 export '[invalid uri]';
898 export 'package:aaa/a2.dart';
899
900 part 'a3.dart';
901 part '[invalid uri]';
902 ''';
903 addTestFile(content);
904
905 AnalysisResult result = await driver.getResult(testFile);
906 expect(result.path, testFile);
907 }
908
892 test_getResult_invalidUri_exports_dart() async { 909 test_getResult_invalidUri_exports_dart() async {
893 String content = r''' 910 String content = r'''
894 export 'dart:async'; 911 export 'dart:async';
895 export 'dart:noSuchLib'; 912 export 'dart:noSuchLib';
896 export 'dart:math'; 913 export 'dart:math';
897 '''; 914 ''';
898 addTestFile(content, priority: true); 915 addTestFile(content, priority: true);
899 916
900 AnalysisResult result = await driver.getResult(testFile); 917 AnalysisResult result = await driver.getResult(testFile);
901 expect(result.path, testFile); 918 expect(result.path, testFile);
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 * Return the [provider] specific path for the given Posix [path]. 2012 * Return the [provider] specific path for the given Posix [path].
1996 */ 2013 */
1997 String _p(String path) => provider.convertPath(path); 2014 String _p(String path) => provider.convertPath(path);
1998 2015
1999 static String _md5(String content) { 2016 static String _md5(String content) {
2000 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 2017 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
2001 } 2018 }
2002 } 2019 }
2003 2020
2004 class _SourceMock extends TypedMock implements Source {} 2021 class _SourceMock extends TypedMock implements Source {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698