| 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.src.context.context_test; | 5 library test.src.context.context_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/cancelable_future.dart'; | 10 import 'package:analyzer/src/cancelable_future.dart'; |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 _sourceFactory = _context.sourceFactory; | 1016 _sourceFactory = _context.sourceFactory; |
| 1017 Source source = _addSource("/test.dart", "class A {}"); | 1017 Source source = _addSource("/test.dart", "class A {}"); |
| 1018 LibraryElement library = _context.computeLibraryElement(source); | 1018 LibraryElement library = _context.computeLibraryElement(source); |
| 1019 expect(library, isNotNull); | 1019 expect(library, isNotNull); |
| 1020 Namespace namespace = _context.getPublicNamespace(library); | 1020 Namespace namespace = _context.getPublicNamespace(library); |
| 1021 expect(namespace, isNotNull); | 1021 expect(namespace, isNotNull); |
| 1022 EngineTestCase.assertInstanceOf( | 1022 EngineTestCase.assertInstanceOf( |
| 1023 (obj) => obj is ClassElement, ClassElement, namespace.get("A")); | 1023 (obj) => obj is ClassElement, ClassElement, namespace.get("A")); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 void fail_getRefactoringUnsafeSources() { | |
| 1027 // not sources initially | |
| 1028 List<Source> sources = _context.refactoringUnsafeSources; | |
| 1029 expect(sources, hasLength(0)); | |
| 1030 // add new source, unresolved | |
| 1031 Source source = _addSource("/test.dart", "library lib;"); | |
| 1032 sources = _context.refactoringUnsafeSources; | |
| 1033 expect(sources, hasLength(1)); | |
| 1034 expect(sources[0], source); | |
| 1035 // resolve source | |
| 1036 _context.computeLibraryElement(source); | |
| 1037 sources = _context.refactoringUnsafeSources; | |
| 1038 expect(sources, hasLength(0)); | |
| 1039 } | |
| 1040 | |
| 1041 void fail_getResolvedCompilationUnit_library() { | 1026 void fail_getResolvedCompilationUnit_library() { |
| 1042 _context = contextWithCore(); | 1027 _context = contextWithCore(); |
| 1043 _sourceFactory = _context.sourceFactory; | 1028 _sourceFactory = _context.sourceFactory; |
| 1044 Source source = _addSource("/lib.dart", "library libb;"); | 1029 Source source = _addSource("/lib.dart", "library libb;"); |
| 1045 LibraryElement library = _context.computeLibraryElement(source); | 1030 LibraryElement library = _context.computeLibraryElement(source); |
| 1046 expect(_context.getResolvedCompilationUnit(source, library), isNotNull); | 1031 expect(_context.getResolvedCompilationUnit(source, library), isNotNull); |
| 1047 _context.setContents(source, "library lib;"); | 1032 _context.setContents(source, "library lib;"); |
| 1048 expect(_context.getResolvedCompilationUnit(source, library), isNull); | 1033 expect(_context.getResolvedCompilationUnit(source, library), isNull); |
| 1049 } | 1034 } |
| 1050 | 1035 |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 : super(name, UriKind.FILE_URI); | 2488 : super(name, UriKind.FILE_URI); |
| 2504 | 2489 |
| 2505 @override | 2490 @override |
| 2506 TimestampedData<String> get contents { | 2491 TimestampedData<String> get contents { |
| 2507 throw 'Read error'; | 2492 throw 'Read error'; |
| 2508 } | 2493 } |
| 2509 | 2494 |
| 2510 @override | 2495 @override |
| 2511 bool exists() => true; | 2496 bool exists() => true; |
| 2512 } | 2497 } |
| OLD | NEW |