| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.test_support; | 8 library engine.test_support; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 * @return the source string composed of the given lines | 425 * @return the source string composed of the given lines |
| 426 */ | 426 */ |
| 427 static String createSource(List<String> lines) { | 427 static String createSource(List<String> lines) { |
| 428 PrintStringWriter writer = new PrintStringWriter(); | 428 PrintStringWriter writer = new PrintStringWriter(); |
| 429 for (String line in lines) { | 429 for (String line in lines) { |
| 430 writer.println(line); | 430 writer.println(line); |
| 431 } | 431 } |
| 432 return writer.toString(); | 432 return writer.toString(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 static dartSuite() { | |
| 436 _ut.group('EngineTestCase', () { | |
| 437 }); | |
| 438 } | |
| 439 | |
| 440 /** | 435 /** |
| 441 * @return the [AstNode] with requested type at offset of the "prefix". | 436 * @return the [AstNode] with requested type at offset of the "prefix". |
| 442 */ | 437 */ |
| 443 static AstNode findNode(AstNode root, String code, String prefix, | 438 static AstNode findNode(AstNode root, String code, String prefix, |
| 444 Predicate<AstNode> predicate) { | 439 Predicate<AstNode> predicate) { |
| 445 int offset = code.indexOf(prefix); | 440 int offset = code.indexOf(prefix); |
| 446 if (offset == -1) { | 441 if (offset == -1) { |
| 447 throw new IllegalArgumentException("Not found '${prefix}'."); | 442 throw new IllegalArgumentException("Not found '${prefix}'."); |
| 448 } | 443 } |
| 449 AstNode node = new NodeLocator.con1(offset).searchWithin(root); | 444 AstNode node = new NodeLocator.con1(offset).searchWithin(root); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 builder.append("; "); | 660 builder.append("; "); |
| 666 } | 661 } |
| 667 builder.append(expectedCount); | 662 builder.append(expectedCount); |
| 668 builder.append(" errors of type "); | 663 builder.append(" errors of type "); |
| 669 builder.append("${code.runtimeType.toString()}.${code}"); | 664 builder.append("${code.runtimeType.toString()}.${code}"); |
| 670 builder.append(", found "); | 665 builder.append(", found "); |
| 671 builder.append(actualCount); | 666 builder.append(actualCount); |
| 672 } | 667 } |
| 673 } | 668 } |
| 674 // | 669 // |
| 675 | 670 // Check that there are no more errors in the actual-errors map, |
| 676 | 671 // otherwise record message. |
| 677 | |
| 678 | |
| 679 // Check that there are no more errors in the actual-errors map, otherwi
se, record message. | |
| 680 // | 672 // |
| 681 for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet( | 673 for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet( |
| 682 errorsByCode)) { | 674 errorsByCode)) { |
| 683 ErrorCode code = entry.getKey(); | 675 ErrorCode code = entry.getKey(); |
| 684 List<AnalysisError> actualErrors = entry.getValue(); | 676 List<AnalysisError> actualErrors = entry.getValue(); |
| 685 int actualCount = actualErrors.length; | 677 int actualCount = actualErrors.length; |
| 686 if (builder.length == 0) { | 678 if (builder.length == 0) { |
| 687 builder.append("Expected "); | 679 builder.append("Expected "); |
| 688 } else { | 680 } else { |
| 689 builder.append("; "); | 681 builder.append("; "); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 /** | 961 /** |
| 970 * The number of times that the contents of this source have been requested. | 962 * The number of times that the contents of this source have been requested. |
| 971 */ | 963 */ |
| 972 int readCount = 0; | 964 int readCount = 0; |
| 973 | 965 |
| 974 TestSource([this._name = '/test.dart', this._contents]); | 966 TestSource([this._name = '/test.dart', this._contents]); |
| 975 | 967 |
| 976 TimestampedData<String> get contents { | 968 TimestampedData<String> get contents { |
| 977 readCount++; | 969 readCount++; |
| 978 if (generateExceptionOnRead) { | 970 if (generateExceptionOnRead) { |
| 979 throw new Exception("I/O Exception while getting the contents of " + _name
); | 971 String msg = "I/O Exception while getting the contents of " + _name; |
| 972 throw new Exception(msg); |
| 980 } | 973 } |
| 981 return new TimestampedData<String>(0, _contents); | 974 return new TimestampedData<String>(0, _contents); |
| 982 } | 975 } |
| 983 void setContents(String value) { | 976 void setContents(String value) { |
| 984 modificationStamp = new DateTime.now().millisecondsSinceEpoch; | 977 modificationStamp = new DateTime.now().millisecondsSinceEpoch; |
| 985 _contents = value; | 978 _contents = value; |
| 986 } | 979 } |
| 987 String get encoding { | 980 String get encoding { |
| 988 throw new UnsupportedOperationException(); | 981 throw new UnsupportedOperationException(); |
| 989 } | 982 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1013 void getContentsToReceiver(Source_ContentReceiver receiver) { | 1006 void getContentsToReceiver(Source_ContentReceiver receiver) { |
| 1014 throw new UnsupportedOperationException(); | 1007 throw new UnsupportedOperationException(); |
| 1015 } | 1008 } |
| 1016 Source resolve(String uri) { | 1009 Source resolve(String uri) { |
| 1017 throw new UnsupportedOperationException(); | 1010 throw new UnsupportedOperationException(); |
| 1018 } | 1011 } |
| 1019 Uri resolveRelativeUri(Uri uri) { | 1012 Uri resolveRelativeUri(Uri uri) { |
| 1020 return new Uri(scheme: 'file', path: _name).resolveUri(uri); | 1013 return new Uri(scheme: 'file', path: _name).resolveUri(uri); |
| 1021 } | 1014 } |
| 1022 } | 1015 } |
| OLD | NEW |