| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 test.context.directory.manager; | 5 library test.context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/context_manager.dart'; | 9 import 'package:analysis_server/src/context_manager.dart'; |
| 10 import 'package:analysis_server/src/utilities/null_string_sink.dart'; | 10 import 'package:analysis_server/src/utilities/null_string_sink.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 import 'package:plugin/plugin.dart'; | 32 import 'package:plugin/plugin.dart'; |
| 33 import 'package:test/test.dart'; | 33 import 'package:test/test.dart'; |
| 34 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 34 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 35 | 35 |
| 36 import 'mock_sdk.dart'; | 36 import 'mock_sdk.dart'; |
| 37 import 'mocks.dart'; | 37 import 'mocks.dart'; |
| 38 | 38 |
| 39 main() { | 39 main() { |
| 40 defineReflectiveSuite(() { | 40 defineReflectiveSuite(() { |
| 41 defineReflectiveTests(AbstractContextManagerTest); | 41 defineReflectiveTests(AbstractContextManagerTest); |
| 42 defineReflectiveTests(AbstractContextManagerTest_Driver); | |
| 43 defineReflectiveTests(ContextManagerWithNewOptionsTest); | 42 defineReflectiveTests(ContextManagerWithNewOptionsTest); |
| 44 defineReflectiveTests(ContextManagerWithNewOptionsTest_Driver); | |
| 45 defineReflectiveTests(ContextManagerWithOldOptionsTest); | 43 defineReflectiveTests(ContextManagerWithOldOptionsTest); |
| 46 defineReflectiveTests(ContextManagerWithOldOptionsTest_Driver); | |
| 47 }); | 44 }); |
| 48 } | 45 } |
| 49 | 46 |
| 50 @reflectiveTest | 47 @reflectiveTest |
| 51 class AbstractContextManagerTest extends ContextManagerTest { | 48 class AbstractContextManagerTest extends ContextManagerTest { |
| 52 void test_contextsInAnalysisRoot_nestedContext() { | 49 void test_contextsInAnalysisRoot_nestedContext() { |
| 53 String subProjPath = path.posix.join(projPath, 'subproj'); | 50 String subProjPath = path.posix.join(projPath, 'subproj'); |
| 54 Folder subProjFolder = resourceProvider.newFolder(subProjPath); | 51 Folder subProjFolder = resourceProvider.newFolder(subProjPath); |
| 55 resourceProvider.newFile( | 52 resourceProvider.newFile( |
| 56 path.posix.join(subProjPath, 'pubspec.yaml'), 'contents'); | 53 path.posix.join(subProjPath, 'pubspec.yaml'), 'contents'); |
| (...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 // TODO(brianwilkerson) Figure out how to test this. Possibly by comparing | 1701 // TODO(brianwilkerson) Figure out how to test this. Possibly by comparing |
| 1705 // the contents of the package map (although that approach doesn't work at | 1702 // the contents of the package map (although that approach doesn't work at |
| 1706 // the moment). | 1703 // the moment). |
| 1707 // FolderDisposition disposition = callbacks.currentContextDispositions[path]
; | 1704 // FolderDisposition disposition = callbacks.currentContextDispositions[path]
; |
| 1708 // expect(disposition.packageRoot, expectation); | 1705 // expect(disposition.packageRoot, expectation); |
| 1709 // TODO(paulberry): we should also verify that the package map itself is | 1706 // TODO(paulberry): we should also verify that the package map itself is |
| 1710 // correct. See dartbug.com/23909. | 1707 // correct. See dartbug.com/23909. |
| 1711 } | 1708 } |
| 1712 } | 1709 } |
| 1713 | 1710 |
| 1714 @reflectiveTest | |
| 1715 class AbstractContextManagerTest_Driver extends AbstractContextManagerTest { | |
| 1716 bool get enableAnalysisDriver => true; | |
| 1717 | |
| 1718 @failingTest | |
| 1719 test_embedder_added() { | |
| 1720 // NoSuchMethodError: The getter 'apiSignature' was called on null. | |
| 1721 // Receiver: null | |
| 1722 // Tried calling: apiSignature | |
| 1723 // dart:core Object
.noSuchMethod | |
| 1724 // package:analyzer/src/dart/analysis/driver.dart 460:20 Analys
isDriver.configure | |
| 1725 // package:analysis_server/src/context_manager.dart 1043:16 Contex
tManagerImpl._checkForPackagespecUpdate | |
| 1726 // package:analysis_server/src/context_manager.dart 1553:5 Contex
tManagerImpl._handleWatchEvent | |
| 1727 //return super.test_embedder_added(); | |
| 1728 fail('NoSuchMethodError'); | |
| 1729 } | |
| 1730 | |
| 1731 @failingTest | |
| 1732 test_embedder_packagespec() async { | |
| 1733 // NoSuchMethodError: The getter 'apiSignature' was called on null. | |
| 1734 // Receiver: null | |
| 1735 // Tried calling: apiSignature | |
| 1736 // dart:core Object
.noSuchMethod | |
| 1737 // package:analyzer/src/dart/analysis/driver.dart 248:20 Analys
isDriver.AnalysisDriver | |
| 1738 // test/context_manager_test.dart 2698:25 TestCo
ntextManagerCallbacks.addAnalysisDriver | |
| 1739 // package:analysis_server/src/context_manager.dart 1186:39 Contex
tManagerImpl._createContext | |
| 1740 // package:analysis_server/src/context_manager.dart 1247:16 Contex
tManagerImpl._createContexts | |
| 1741 // package:analysis_server/src/context_manager.dart 886:9 Contex
tManagerImpl.setRoots | |
| 1742 // test/context_manager_test.dart 154:13 Abstra
ctContextManagerTest.test_embedder_packagespec.<async> | |
| 1743 return super.test_embedder_packagespec(); | |
| 1744 } | |
| 1745 } | |
| 1746 | |
| 1747 abstract class ContextManagerTest { | 1711 abstract class ContextManagerTest { |
| 1748 /** | 1712 /** |
| 1749 * The name of the 'bin' directory. | 1713 * The name of the 'bin' directory. |
| 1750 */ | 1714 */ |
| 1751 static const String BIN_NAME = 'bin'; | 1715 static const String BIN_NAME = 'bin'; |
| 1752 | 1716 |
| 1753 /** | 1717 /** |
| 1754 * The name of the 'example' directory. | 1718 * The name of the 'example' directory. |
| 1755 */ | 1719 */ |
| 1756 static const String EXAMPLE_NAME = 'example'; | 1720 static const String EXAMPLE_NAME = 'example'; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 } | 1885 } |
| 1922 } | 1886 } |
| 1923 } | 1887 } |
| 1924 | 1888 |
| 1925 @reflectiveTest | 1889 @reflectiveTest |
| 1926 class ContextManagerWithNewOptionsTest extends ContextManagerWithOptionsTest { | 1890 class ContextManagerWithNewOptionsTest extends ContextManagerWithOptionsTest { |
| 1927 String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE; | 1891 String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE; |
| 1928 } | 1892 } |
| 1929 | 1893 |
| 1930 @reflectiveTest | 1894 @reflectiveTest |
| 1931 class ContextManagerWithNewOptionsTest_Driver | |
| 1932 extends ContextManagerWithNewOptionsTest { | |
| 1933 bool get enableAnalysisDriver => true; | |
| 1934 | |
| 1935 @failingTest | |
| 1936 test_analysis_options_file_delete_with_embedder() async { | |
| 1937 // This fails because the ContextBuilder doesn't pick up the strongMode | |
| 1938 // flag from the embedder.yaml file. | |
| 1939 return super.test_analysis_options_file_delete_with_embedder(); | |
| 1940 } | |
| 1941 | |
| 1942 @failingTest | |
| 1943 test_embedder_options() async { | |
| 1944 // This fails because the ContextBuilder doesn't pick up the strongMode | |
| 1945 // flag from the embedder.yaml file. | |
| 1946 return super.test_embedder_options(); | |
| 1947 } | |
| 1948 | |
| 1949 @failingTest | |
| 1950 test_optionsFile_update_strongMode() async { | |
| 1951 // It appears that this fails because we are not correctly updating the | |
| 1952 // analysis options in the driver when the file is modified. | |
| 1953 //return super.test_optionsFile_update_strongMode(); | |
| 1954 // After a few other changes, the test now times out on my machine, so I'm | |
| 1955 // disabling it in order to prevent it from being flaky. | |
| 1956 fail('Test times out'); | |
| 1957 } | |
| 1958 | |
| 1959 @failingTest | |
| 1960 test_path_filter_analysis_option() async { | |
| 1961 // This fails because we're not analyzing the analyis options file. | |
| 1962 return super.test_path_filter_analysis_option(); | |
| 1963 } | |
| 1964 } | |
| 1965 | |
| 1966 @reflectiveTest | |
| 1967 class ContextManagerWithOldOptionsTest extends ContextManagerWithOptionsTest { | 1895 class ContextManagerWithOldOptionsTest extends ContextManagerWithOptionsTest { |
| 1968 String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_FILE; | 1896 String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_FILE; |
| 1969 } | 1897 } |
| 1970 | 1898 |
| 1971 @reflectiveTest | |
| 1972 class ContextManagerWithOldOptionsTest_Driver | |
| 1973 extends ContextManagerWithOldOptionsTest { | |
| 1974 bool get enableAnalysisDriver => true; | |
| 1975 | |
| 1976 @failingTest | |
| 1977 test_analysis_options_file_delete_with_embedder() async { | |
| 1978 // This fails because the ContextBuilder doesn't pick up the strongMode | |
| 1979 // flag from the embedder.yaml file. | |
| 1980 return super.test_analysis_options_file_delete_with_embedder(); | |
| 1981 } | |
| 1982 | |
| 1983 @failingTest | |
| 1984 test_embedder_options() async { | |
| 1985 // This fails because the ContextBuilder doesn't pick up the strongMode | |
| 1986 // flag from the embedder.yaml file. | |
| 1987 return super.test_embedder_options(); | |
| 1988 } | |
| 1989 | |
| 1990 @failingTest | |
| 1991 test_optionsFile_update_strongMode() async { | |
| 1992 // It appears that this fails because we are not correctly updating the | |
| 1993 // analysis options in the driver when the file is modified. | |
| 1994 //return super.test_optionsFile_update_strongMode(); | |
| 1995 // After a few other changes, the test now times out on my machine, so I'm | |
| 1996 // disabling it in order to prevent it from being flaky. | |
| 1997 fail('Test times out'); | |
| 1998 } | |
| 1999 | |
| 2000 @failingTest | |
| 2001 test_path_filter_analysis_option() async { | |
| 2002 // This fails because we're not analyzing the analyis options file. | |
| 2003 return super.test_path_filter_analysis_option(); | |
| 2004 } | |
| 2005 } | |
| 2006 | |
| 2007 abstract class ContextManagerWithOptionsTest extends ContextManagerTest { | 1899 abstract class ContextManagerWithOptionsTest extends ContextManagerTest { |
| 2008 String get optionsFileName; | 1900 String get optionsFileName; |
| 2009 | 1901 |
| 2010 test_analysis_options_file_delete() async { | 1902 test_analysis_options_file_delete() async { |
| 2011 // Setup analysis options | 1903 // Setup analysis options |
| 2012 newFile( | 1904 newFile( |
| 2013 [projPath, optionsFileName], | 1905 [projPath, optionsFileName], |
| 2014 r''' | 1906 r''' |
| 2015 embedded_libs: | 1907 embedded_libs: |
| 2016 "dart:foobar": "../sdk_ext/entry.dart" | 1908 "dart:foobar": "../sdk_ext/entry.dart" |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 class TestUriResolver extends UriResolver { | 2884 class TestUriResolver extends UriResolver { |
| 2993 Map<Uri, Source> uriMap; | 2885 Map<Uri, Source> uriMap; |
| 2994 | 2886 |
| 2995 TestUriResolver(this.uriMap); | 2887 TestUriResolver(this.uriMap); |
| 2996 | 2888 |
| 2997 @override | 2889 @override |
| 2998 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 2890 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 2999 return uriMap[uri]; | 2891 return uriMap[uri]; |
| 3000 } | 2892 } |
| 3001 } | 2893 } |
| OLD | NEW |