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 analyzer.test.src.dart.element.element_test; | 5 library analyzer.test.src.dart.element.element_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/constant/value.dart'; | 8 import 'package:analyzer/dart/constant/value.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
11 import 'package:analyzer/src/dart/element/element.dart'; | 11 import 'package:analyzer/src/dart/element/element.dart'; |
12 import 'package:analyzer/src/dart/element/handle.dart'; | 12 import 'package:analyzer/src/dart/element/handle.dart'; |
13 import 'package:analyzer/src/dart/element/type.dart'; | 13 import 'package:analyzer/src/dart/element/type.dart'; |
14 import 'package:analyzer/src/generated/engine.dart' | 14 import 'package:analyzer/src/generated/engine.dart' |
15 show AnalysisContext, AnalysisOptionsImpl; | 15 show AnalysisContext, AnalysisOptionsImpl; |
16 import 'package:analyzer/src/generated/java_core.dart'; | |
17 import 'package:analyzer/src/generated/source_io.dart'; | 16 import 'package:analyzer/src/generated/source_io.dart'; |
18 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 17 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
19 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 18 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
20 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 19 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
21 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 20 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
22 import 'package:unittest/unittest.dart'; | 21 import 'package:unittest/unittest.dart'; |
23 | 22 |
24 import '../../../generated/analysis_context_factory.dart' | 23 import '../../../generated/analysis_context_factory.dart' |
25 show AnalysisContextHelper; | 24 show AnalysisContextHelper; |
26 import '../../../generated/resolver_test_case.dart'; | 25 import '../../../generated/resolver_test_case.dart'; |
(...skipping 3908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3935 | 3934 |
3936 library.invalidateLibraryCycles(); | 3935 library.invalidateLibraryCycles(); |
3937 } | 3936 } |
3938 | 3937 |
3939 void test_isUpToDate() { | 3938 void test_isUpToDate() { |
3940 AnalysisContext context = createAnalysisContext(); | 3939 AnalysisContext context = createAnalysisContext(); |
3941 context.sourceFactory = new SourceFactory([]); | 3940 context.sourceFactory = new SourceFactory([]); |
3942 LibraryElement library = ElementFactory.library(context, "foo"); | 3941 LibraryElement library = ElementFactory.library(context, "foo"); |
3943 context.setContents(library.definingCompilationUnit.source, "sdfsdff"); | 3942 context.setContents(library.definingCompilationUnit.source, "sdfsdff"); |
3944 // Assert that we are not up to date if the target has an old time stamp. | 3943 // Assert that we are not up to date if the target has an old time stamp. |
3945 expect(library.isUpToDate(0), isFalse); | 3944 expect(library.isUpToDate(-1), isFalse); |
3946 // Assert that we are up to date with a target modification time in the | 3945 // Assert that we are up to date with a target modification time in the |
3947 // future. | 3946 // future. |
3948 expect(library.isUpToDate(JavaSystem.currentTimeMillis() + 1000), isTrue); | 3947 expect(library.isUpToDate(1 << 33), isTrue); |
3949 } | 3948 } |
3950 | 3949 |
3951 void test_setImports() { | 3950 void test_setImports() { |
3952 AnalysisContext context = createAnalysisContext(); | 3951 AnalysisContext context = createAnalysisContext(); |
3953 LibraryElementImpl library = new LibraryElementImpl.forNode( | 3952 LibraryElementImpl library = new LibraryElementImpl.forNode( |
3954 context, AstFactory.libraryIdentifier2(["l1"])); | 3953 context, AstFactory.libraryIdentifier2(["l1"])); |
3955 List<ImportElementImpl> expectedImports = [ | 3954 List<ImportElementImpl> expectedImports = [ |
3956 ElementFactory.importFor(ElementFactory.library(context, "l2"), null), | 3955 ElementFactory.importFor(ElementFactory.library(context, "l2"), null), |
3957 ElementFactory.importFor(ElementFactory.library(context, "l3"), null) | 3956 ElementFactory.importFor(ElementFactory.library(context, "l3"), null) |
3958 ]; | 3957 ]; |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4504 } | 4503 } |
4505 | 4504 |
4506 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction | 4505 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction |
4507 extends InterfaceTypeImpl { | 4506 extends InterfaceTypeImpl { |
4508 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) | 4507 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) |
4509 : super(arg0); | 4508 : super(arg0); |
4510 | 4509 |
4511 @override | 4510 @override |
4512 bool get isDartCoreFunction => true; | 4511 bool get isDartCoreFunction => true; |
4513 } | 4512 } |
OLD | NEW |