| OLD | NEW |
| 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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 Future<AnalysisResult> future2 = driver.getResult(testFile); | 1110 Future<AnalysisResult> future2 = driver.getResult(testFile); |
| 1111 | 1111 |
| 1112 // Both futures complete, with the same result. | 1112 // Both futures complete, with the same result. |
| 1113 AnalysisResult result1 = await future1; | 1113 AnalysisResult result1 = await future1; |
| 1114 AnalysisResult result2 = await future2; | 1114 AnalysisResult result2 = await future2; |
| 1115 expect(result2, same(result1)); | 1115 expect(result2, same(result1)); |
| 1116 expect(result1.path, testFile); | 1116 expect(result1.path, testFile); |
| 1117 expect(result1.unit, isNotNull); | 1117 expect(result1.unit, isNotNull); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 test_getSourceKind_library() async { |
| 1121 var path = _p('/test/lib/test.dart'); |
| 1122 provider.newFile(path, 'class A {}'); |
| 1123 expect(await driver.getSourceKind(path), SourceKind.LIBRARY); |
| 1124 } |
| 1125 |
| 1126 test_getSourceKind_notDartFile() async { |
| 1127 var path = _p('/test/lib/test.txt'); |
| 1128 provider.newFile(path, 'class A {}'); |
| 1129 expect(await driver.getSourceKind(path), isNull); |
| 1130 } |
| 1131 |
| 1132 test_getSourceKind_part() async { |
| 1133 var path = _p('/test/lib/test.dart'); |
| 1134 provider.newFile(path, 'part of lib; class A {}'); |
| 1135 expect(await driver.getSourceKind(path), SourceKind.PART); |
| 1136 } |
| 1137 |
| 1120 test_getTopLevelNameDeclarations() async { | 1138 test_getTopLevelNameDeclarations() async { |
| 1121 var a = _p('/test/lib/a.dart'); | 1139 var a = _p('/test/lib/a.dart'); |
| 1122 var b = _p('/test/lib/b.dart'); | 1140 var b = _p('/test/lib/b.dart'); |
| 1123 var c = _p('/test/lib/c.dart'); | 1141 var c = _p('/test/lib/c.dart'); |
| 1124 var d = _p('/test/lib/d.dart'); | 1142 var d = _p('/test/lib/d.dart'); |
| 1125 | 1143 |
| 1126 provider.newFile(a, 'class A {}'); | 1144 provider.newFile(a, 'class A {}'); |
| 1127 provider.newFile(b, 'export "a.dart", class B {}'); | 1145 provider.newFile(b, 'export "a.dart", class B {}'); |
| 1128 provider.newFile(c, 'import "d.dart"; class C {}'); | 1146 provider.newFile(c, 'import "d.dart"; class C {}'); |
| 1129 provider.newFile(d, 'class D {}'); | 1147 provider.newFile(d, 'class D {}'); |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 * Return the [provider] specific path for the given Posix [path]. | 1995 * Return the [provider] specific path for the given Posix [path]. |
| 1978 */ | 1996 */ |
| 1979 String _p(String path) => provider.convertPath(path); | 1997 String _p(String path) => provider.convertPath(path); |
| 1980 | 1998 |
| 1981 static String _md5(String content) { | 1999 static String _md5(String content) { |
| 1982 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2000 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 1983 } | 2001 } |
| 1984 } | 2002 } |
| 1985 | 2003 |
| 1986 class _SourceMock extends TypedMock implements Source {} | 2004 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |