| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 855 |
| 856 var result = await driver.getResult(a); | 856 var result = await driver.getResult(a); |
| 857 | 857 |
| 858 // The content that was set into the overlay for "b" should be visible | 858 // The content that was set into the overlay for "b" should be visible |
| 859 // through the AnalysisContext that was used to analyze "a". | 859 // through the AnalysisContext that was used to analyze "a". |
| 860 CompilationUnitElement unitA = result.unit.element; | 860 CompilationUnitElement unitA = result.unit.element; |
| 861 Source sourceB = unitA.library.imports[0].importedLibrary.source; | 861 Source sourceB = unitA.library.imports[0].importedLibrary.source; |
| 862 expect(unitA.context.getContents(sourceB).data, 'var v = 2;'); | 862 expect(unitA.context.getContents(sourceB).data, 'var v = 2;'); |
| 863 } | 863 } |
| 864 | 864 |
| 865 test_getResult_functionTypeFormalParameter_withTypeParameter() async { |
| 866 // This was code crashing because of incomplete implementation. |
| 867 // Consider (re)moving after fixing dartbug.com/28515 |
| 868 addTestFile(r''' |
| 869 class A { |
| 870 int foo( bar<T extends B>() ) {} |
| 871 } |
| 872 class B {} |
| 873 '''); |
| 874 |
| 875 AnalysisResult result = await driver.getResult(testFile); |
| 876 expect(result.path, testFile); |
| 877 } |
| 878 |
| 865 test_getResult_inferTypes_finalField() async { | 879 test_getResult_inferTypes_finalField() async { |
| 866 addTestFile( | 880 addTestFile( |
| 867 r''' | 881 r''' |
| 868 class C { | 882 class C { |
| 869 final f = 42; | 883 final f = 42; |
| 870 } | 884 } |
| 871 ''', | 885 ''', |
| 872 priority: true); | 886 priority: true); |
| 873 await scheduler.waitForIdle(); | 887 await scheduler.waitForIdle(); |
| 874 | 888 |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2051 * Return the [provider] specific path for the given Posix [path]. | 2065 * Return the [provider] specific path for the given Posix [path]. |
| 2052 */ | 2066 */ |
| 2053 String _p(String path) => provider.convertPath(path); | 2067 String _p(String path) => provider.convertPath(path); |
| 2054 | 2068 |
| 2055 static String _md5(String content) { | 2069 static String _md5(String content) { |
| 2056 return hex.encode(md5.convert(UTF8.encode(content)).bytes); | 2070 return hex.encode(md5.convert(UTF8.encode(content)).bytes); |
| 2057 } | 2071 } |
| 2058 } | 2072 } |
| 2059 | 2073 |
| 2060 class _SourceMock extends TypedMock implements Source {} | 2074 class _SourceMock extends TypedMock implements Source {} |
| OLD | NEW |