OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub | 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub |
6 /// tests are integration tests that stage some stuff on the file system, run | 6 /// tests are integration tests that stage some stuff on the file system, run |
7 /// pub, and then validate the results. This library provides an API to build | 7 /// pub, and then validate the results. This library provides an API to build |
8 /// tests like that. | 8 /// tests like that. |
9 library test_pub; | 9 library test_pub; |
10 | 10 |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 /// A matcher that matches a Pair. | 785 /// A matcher that matches a Pair. |
786 Matcher pairOf(Matcher firstMatcher, Matcher lastMatcher) => | 786 Matcher pairOf(Matcher firstMatcher, Matcher lastMatcher) => |
787 new _PairMatcher(firstMatcher, lastMatcher); | 787 new _PairMatcher(firstMatcher, lastMatcher); |
788 | 788 |
789 class _PairMatcher extends BaseMatcher { | 789 class _PairMatcher extends BaseMatcher { |
790 final Matcher _firstMatcher; | 790 final Matcher _firstMatcher; |
791 final Matcher _lastMatcher; | 791 final Matcher _lastMatcher; |
792 | 792 |
793 _PairMatcher(this._firstMatcher, this._lastMatcher); | 793 _PairMatcher(this._firstMatcher, this._lastMatcher); |
794 | 794 |
795 bool matches(item, MatchState matchState) { | 795 bool matches(item, Map matchState) { |
796 if (item is! Pair) return false; | 796 if (item is! Pair) return false; |
797 return _firstMatcher.matches(item.first, matchState) && | 797 return _firstMatcher.matches(item.first, matchState) && |
798 _lastMatcher.matches(item.last, matchState); | 798 _lastMatcher.matches(item.last, matchState); |
799 } | 799 } |
800 | 800 |
801 Description describe(Description description) { | 801 Description describe(Description description) { |
802 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 802 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
803 } | 803 } |
804 } | 804 } |
OLD | NEW |