| 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 List<AnalysisError> list = errorsByCode[code]; | 635 List<AnalysisError> list = errorsByCode[code]; |
| 636 if (list == null) { | 636 if (list == null) { |
| 637 list = new List<AnalysisError>(); | 637 list = new List<AnalysisError>(); |
| 638 errorsByCode[code] = list; | 638 errorsByCode[code] = list; |
| 639 } | 639 } |
| 640 list.add(error); | 640 list.add(error); |
| 641 } | 641 } |
| 642 // | 642 // |
| 643 // Compare the expected and actual number of each type of error. | 643 // Compare the expected and actual number of each type of error. |
| 644 // | 644 // |
| 645 for (MapEntry<ErrorCode, int> entry in getMapEntrySet(expectedCounts)) { | 645 expectedCounts.forEach((ErrorCode code, int expectedCount) { |
| 646 ErrorCode code = entry.getKey(); | |
| 647 int expectedCount = entry.getValue(); | |
| 648 int actualCount; | 646 int actualCount; |
| 649 List<AnalysisError> list = errorsByCode.remove(code); | 647 List<AnalysisError> list = errorsByCode.remove(code); |
| 650 if (list == null) { | 648 if (list == null) { |
| 651 actualCount = 0; | 649 actualCount = 0; |
| 652 } else { | 650 } else { |
| 653 actualCount = list.length; | 651 actualCount = list.length; |
| 654 } | 652 } |
| 655 if (actualCount != expectedCount) { | 653 if (actualCount != expectedCount) { |
| 656 if (buffer.length == 0) { | 654 if (buffer.length == 0) { |
| 657 buffer.write("Expected "); | 655 buffer.write("Expected "); |
| 658 } else { | 656 } else { |
| 659 buffer.write("; "); | 657 buffer.write("; "); |
| 660 } | 658 } |
| 661 buffer.write(expectedCount); | 659 buffer.write(expectedCount); |
| 662 buffer.write(" errors of type "); | 660 buffer.write(" errors of type "); |
| 663 buffer.write("${code.runtimeType}.$code"); | 661 buffer.write("${code.runtimeType}.$code"); |
| 664 buffer.write(", found "); | 662 buffer.write(", found "); |
| 665 buffer.write(actualCount); | 663 buffer.write(actualCount); |
| 666 } | 664 } |
| 667 } | 665 }); |
| 668 // | 666 // |
| 669 // Check that there are no more errors in the actual-errors map, | 667 // Check that there are no more errors in the actual-errors map, |
| 670 // otherwise record message. | 668 // otherwise record message. |
| 671 // | 669 // |
| 672 for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet( | 670 errorsByCode.forEach((ErrorCode code, List<AnalysisError> actualErrors) { |
| 673 errorsByCode)) { | |
| 674 ErrorCode code = entry.getKey(); | |
| 675 List<AnalysisError> actualErrors = entry.getValue(); | |
| 676 int actualCount = actualErrors.length; | 671 int actualCount = actualErrors.length; |
| 677 if (buffer.length == 0) { | 672 if (buffer.length == 0) { |
| 678 buffer.write("Expected "); | 673 buffer.write("Expected "); |
| 679 } else { | 674 } else { |
| 680 buffer.write("; "); | 675 buffer.write("; "); |
| 681 } | 676 } |
| 682 buffer.write("0 errors of type "); | 677 buffer.write("0 errors of type "); |
| 683 buffer.write("${code.runtimeType}.$code"); | 678 buffer.write("${code.runtimeType}.$code"); |
| 684 buffer.write(", found "); | 679 buffer.write(", found "); |
| 685 buffer.write(actualCount); | 680 buffer.write(actualCount); |
| 686 buffer.write(" ("); | 681 buffer.write(" ("); |
| 687 for (int i = 0; i < actualErrors.length; i++) { | 682 for (int i = 0; i < actualErrors.length; i++) { |
| 688 AnalysisError error = actualErrors[i]; | 683 AnalysisError error = actualErrors[i]; |
| 689 if (i > 0) { | 684 if (i > 0) { |
| 690 buffer.write(", "); | 685 buffer.write(", "); |
| 691 } | 686 } |
| 692 buffer.write(error.offset); | 687 buffer.write(error.offset); |
| 693 } | 688 } |
| 694 buffer.write(")"); | 689 buffer.write(")"); |
| 695 } | 690 }); |
| 696 if (buffer.length > 0) { | 691 if (buffer.length > 0) { |
| 697 JUnitTestCase.fail(buffer.toString()); | 692 JUnitTestCase.fail(buffer.toString()); |
| 698 } | 693 } |
| 699 } | 694 } |
| 700 | 695 |
| 701 /** | 696 /** |
| 702 * Assert that the number of errors that have been gathered matches the number
of severities that | 697 * Assert that the number of errors that have been gathered matches the number
of severities that |
| 703 * are given and that there are the same number of errors and warnings as spec
ified by the | 698 * are given and that there are the same number of errors and warnings as spec
ified by the |
| 704 * argument. The order in which the errors were gathered is ignored. | 699 * argument. The order in which the errors were gathered is ignored. |
| 705 * | 700 * |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 void getContentsToReceiver(Source_ContentReceiver receiver) { | 1000 void getContentsToReceiver(Source_ContentReceiver receiver) { |
| 1006 throw new UnsupportedOperationException(); | 1001 throw new UnsupportedOperationException(); |
| 1007 } | 1002 } |
| 1008 Source resolve(String uri) { | 1003 Source resolve(String uri) { |
| 1009 throw new UnsupportedOperationException(); | 1004 throw new UnsupportedOperationException(); |
| 1010 } | 1005 } |
| 1011 Uri resolveRelativeUri(Uri uri) { | 1006 Uri resolveRelativeUri(Uri uri) { |
| 1012 return new Uri(scheme: 'file', path: _name).resolveUri(uri); | 1007 return new Uri(scheme: 'file', path: _name).resolveUri(uri); |
| 1013 } | 1008 } |
| 1014 } | 1009 } |
| OLD | NEW |