| 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.generated.test_support; | 5 library analyzer.test.generated.test_support; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier; | 9 import 'package:analyzer/dart/ast/ast.dart' show AstNode, SimpleIdentifier; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| 11 import 'package:analyzer/dart/element/type.dart'; | 11 import 'package:analyzer/dart/element/type.dart'; |
| 12 import 'package:analyzer/error/error.dart'; | 12 import 'package:analyzer/error/error.dart'; |
| 13 import 'package:analyzer/error/listener.dart'; | 13 import 'package:analyzer/error/listener.dart'; |
| 14 import 'package:analyzer/exception/exception.dart'; | 14 import 'package:analyzer/exception/exception.dart'; |
| 15 import 'package:analyzer/src/dart/ast/utilities.dart'; | 15 import 'package:analyzer/src/dart/ast/utilities.dart'; |
| 16 import 'package:analyzer/src/generated/engine.dart'; | 16 import 'package:analyzer/src/generated/engine.dart'; |
| 17 import 'package:analyzer/src/generated/java_engine.dart'; | 17 import 'package:analyzer/src/generated/java_engine.dart'; |
| 18 import 'package:analyzer/src/generated/source.dart'; | 18 import 'package:analyzer/src/generated/source.dart'; |
| 19 import 'package:plugin/manager.dart'; | 19 import 'package:plugin/manager.dart'; |
| 20 import 'package:plugin/plugin.dart'; | 20 import 'package:plugin/plugin.dart'; |
| 21 import 'package:source_span/source_span.dart' as source_span; | |
| 22 import 'package:test/test.dart'; | 21 import 'package:test/test.dart'; |
| 23 | 22 |
| 24 import 'analysis_context_factory.dart'; | 23 import 'analysis_context_factory.dart'; |
| 25 | 24 |
| 26 /** | 25 /** |
| 27 * The class `EngineTestCase` defines utility methods for making assertions. | 26 * The class `EngineTestCase` defines utility methods for making assertions. |
| 28 */ | 27 */ |
| 29 class EngineTestCase { | 28 class EngineTestCase { |
| 30 /** | 29 /** |
| 31 * Assert that the given collection has the same number of elements as the num
ber of specified | 30 * Assert that the given collection has the same number of elements as the num
ber of specified |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 log.add("info: $message"); | 537 log.add("info: $message"); |
| 539 } | 538 } |
| 540 } | 539 } |
| 541 | 540 |
| 542 class TestSource extends Source { | 541 class TestSource extends Source { |
| 543 String _name; | 542 String _name; |
| 544 String _contents; | 543 String _contents; |
| 545 int _modificationStamp = 0; | 544 int _modificationStamp = 0; |
| 546 bool exists2 = true; | 545 bool exists2 = true; |
| 547 | 546 |
| 548 source_span.SourceFile _sourceFile; | |
| 549 | |
| 550 /** | 547 /** |
| 551 * A flag indicating whether an exception should be generated when an attempt | 548 * A flag indicating whether an exception should be generated when an attempt |
| 552 * is made to access the contents of this source. | 549 * is made to access the contents of this source. |
| 553 */ | 550 */ |
| 554 bool generateExceptionOnRead = false; | 551 bool generateExceptionOnRead = false; |
| 555 | 552 |
| 556 /** | 553 /** |
| 557 * The number of times that the contents of this source have been requested. | 554 * The number of times that the contents of this source have been requested. |
| 558 */ | 555 */ |
| 559 int readCount = 0; | 556 int readCount = 0; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 582 } | 579 } |
| 583 | 580 |
| 584 @override | 581 @override |
| 585 int get modificationStamp => | 582 int get modificationStamp => |
| 586 generateExceptionOnRead ? -1 : _modificationStamp; | 583 generateExceptionOnRead ? -1 : _modificationStamp; |
| 587 | 584 |
| 588 String get shortName { | 585 String get shortName { |
| 589 return _name; | 586 return _name; |
| 590 } | 587 } |
| 591 | 588 |
| 592 @override | |
| 593 source_span.SourceFile get sourceFile => | |
| 594 _sourceFile ??= new source_span.SourceFile(_contents, url: uri); | |
| 595 | |
| 596 Uri get uri => new Uri.file(_name); | 589 Uri get uri => new Uri.file(_name); |
| 597 | 590 |
| 598 UriKind get uriKind { | 591 UriKind get uriKind { |
| 599 throw new UnsupportedError('uriKind'); | 592 throw new UnsupportedError('uriKind'); |
| 600 } | 593 } |
| 601 | 594 |
| 602 bool operator ==(Object other) { | 595 bool operator ==(Object other) { |
| 603 if (other is TestSource) { | 596 if (other is TestSource) { |
| 604 return other._name == _name; | 597 return other._name == _name; |
| 605 } | 598 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 return UriKind.FILE_URI; | 637 return UriKind.FILE_URI; |
| 645 } | 638 } |
| 646 | 639 |
| 647 bool operator ==(Object other) { | 640 bool operator ==(Object other) { |
| 648 if (other is TestSource) { | 641 if (other is TestSource) { |
| 649 return other.uri == uri; | 642 return other.uri == uri; |
| 650 } | 643 } |
| 651 return false; | 644 return false; |
| 652 } | 645 } |
| 653 } | 646 } |
| OLD | NEW |