Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: pkg/matcher/test/test_common.dart

Issue 807193003: Re-apply "Remove unittest and matcher from the repo." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/matcher/test/string_matchers_test.dart ('k') | pkg/matcher/test/test_utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 library matcher.test_common;
6
7 import 'dart:collection';
8
9 import 'package:matcher/matcher.dart';
10
11 class Widget {
12 int price;
13 }
14
15 class HasPrice extends CustomMatcher {
16 HasPrice(matcher) : super("Widget with a price that is", "price", matcher);
17 featureValueOf(actual) => actual.price;
18 }
19
20 class SimpleIterable extends IterableBase<int> {
21 final int count;
22
23 SimpleIterable(this.count);
24
25 bool contains(int val) => count < val ? false : true;
26
27 bool any(bool f(element)) {
28 for (var i = 0; i <= count; i++) {
29 if (f(i)) return true;
30 }
31 return false;
32 }
33
34 String toString() => "<[$count]>";
35
36 Iterator get iterator {
37 return new _SimpleIterator(count);
38 }
39 }
40
41 class _SimpleIterator implements Iterator<int> {
42 int _count;
43 int _current;
44
45 _SimpleIterator(this._count);
46
47 bool moveNext() {
48 if (_count > 0) {
49 _current = _count;
50 _count--;
51 return true;
52 }
53 _current = null;
54 return false;
55 }
56
57 int get current => _current;
58 }
59
OLDNEW
« no previous file with comments | « pkg/matcher/test/string_matchers_test.dart ('k') | pkg/matcher/test/test_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698