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

Side by Side Diff: pkg/unittest/mock.dart

Issue 10919024: - Change "static final" to "static const" in the (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months 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/unittest/interactive_html_config.dart ('k') | pkg/unittest/numeric_matchers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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 /** 5 /**
6 * The error formatter for mocking is a bit different from the default one 6 * The error formatter for mocking is a bit different from the default one
7 * for unit testing; instead of the third argument being a 'reason' 7 * for unit testing; instead of the third argument being a 'reason'
8 * it is instead a [signature] describing the method signature filter 8 * it is instead a [signature] describing the method signature filter
9 * that was used to select the logs that were verified. 9 * that was used to select the logs that were verified.
10 */ 10 */
(...skipping 23 matching lines...) Expand all
34 proxy.fail(_mockingErrorFormatter(actual, matcher, reason, 34 proxy.fail(_mockingErrorFormatter(actual, matcher, reason,
35 matchState, verbose)); 35 matchState, verbose));
36 } 36 }
37 } 37 }
38 38
39 _MockFailureHandler _mockFailureHandler = null; 39 _MockFailureHandler _mockFailureHandler = null;
40 40
41 /** 41 /**
42 * [_noArg] is a sentinel value representing no argument. 42 * [_noArg] is a sentinel value representing no argument.
43 */ 43 */
44 final _noArg = const _Sentinel(); 44 const _noArg = const _Sentinel();
45 45
46 /** The ways in which a call to a mock method can be handled. */ 46 /** The ways in which a call to a mock method can be handled. */
47 class Action { 47 class Action {
48 /** Do nothing (void method) */ 48 /** Do nothing (void method) */
49 static final IGNORE = const Action._('IGNORE'); 49 static const IGNORE = const Action._('IGNORE');
50 50
51 /** Return a supplied value. */ 51 /** Return a supplied value. */
52 static final RETURN = const Action._('RETURN'); 52 static const RETURN = const Action._('RETURN');
53 53
54 /** Throw a supplied value. */ 54 /** Throw a supplied value. */
55 static final THROW = const Action._('THROW'); 55 static const THROW = const Action._('THROW');
56 56
57 /** Call a supplied function. */ 57 /** Call a supplied function. */
58 static final PROXY = const Action._('PROXY'); 58 static const PROXY = const Action._('PROXY');
59 59
60 const Action._(this.name); 60 const Action._(this.name);
61 61
62 final String name; 62 final String name;
63 } 63 }
64 64
65 /** 65 /**
66 * The behavior of a method call in the mock library is specified 66 * The behavior of a method call in the mock library is specified
67 * with [Responder]s. A [Responder] has a [value] to throw 67 * with [Responder]s. A [Responder] has a [value] to throw
68 * or return (depending on the type of [action]), 68 * or return (depending on the type of [action]),
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 Matcher happenedAtLeast(count) { 894 Matcher happenedAtLeast(count) {
895 return new _TimesMatcher(count); 895 return new _TimesMatcher(count);
896 } 896 }
897 897
898 /** [happenedAtMost] matches a maximum number of calls. */ 898 /** [happenedAtMost] matches a maximum number of calls. */
899 Matcher happenedAtMost(count) { 899 Matcher happenedAtMost(count) {
900 return new _TimesMatcher(0, count); 900 return new _TimesMatcher(0, count);
901 } 901 }
902 902
903 /** [neverHappened] matches zero calls. */ 903 /** [neverHappened] matches zero calls. */
904 final Matcher neverHappened = const _TimesMatcher(0, 0); 904 const Matcher neverHappened = const _TimesMatcher(0, 0);
905 905
906 /** [happenedOnce] matches exactly one call. */ 906 /** [happenedOnce] matches exactly one call. */
907 final Matcher happenedOnce = const _TimesMatcher(1, 1); 907 const Matcher happenedOnce = const _TimesMatcher(1, 1);
908 908
909 /** [happenedAtLeastOnce] matches one or more calls. */ 909 /** [happenedAtLeastOnce] matches one or more calls. */
910 final Matcher happenedAtLeastOnce = const _TimesMatcher(1); 910 const Matcher happenedAtLeastOnce = const _TimesMatcher(1);
911 911
912 /** [happenedAtMostOnce] matches zero or one call. */ 912 /** [happenedAtMostOnce] matches zero or one call. */
913 final Matcher happenedAtMostOnce = const _TimesMatcher(0, 1); 913 const Matcher happenedAtMostOnce = const _TimesMatcher(0, 1);
914 914
915 /** 915 /**
916 * [_ResultMatcher]s are used to make assertions about the results 916 * [_ResultMatcher]s are used to make assertions about the results
917 * of method calls. These can be used as optional parameters to [getLogs]. 917 * of method calls. These can be used as optional parameters to [getLogs].
918 */ 918 */
919 class _ResultMatcher extends BaseMatcher { 919 class _ResultMatcher extends BaseMatcher {
920 final Action action; 920 final Action action;
921 final Matcher value; 921 final Matcher value;
922 922
923 const _ResultMatcher(this.action, this.value); 923 const _ResultMatcher(this.action, this.value);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 /** 965 /**
966 *[throwing] matches log entrues where the call to a method threw 966 *[throwing] matches log entrues where the call to a method threw
967 * a value that matched [value]. 967 * a value that matched [value].
968 */ 968 */
969 Matcher throwing(value) => 969 Matcher throwing(value) =>
970 new _ResultMatcher(Action.THROW, wrapMatcher(value)); 970 new _ResultMatcher(Action.THROW, wrapMatcher(value));
971 971
972 /** Special values for use with [_ResultSetMatcher] [frequency]. */ 972 /** Special values for use with [_ResultSetMatcher] [frequency]. */
973 class _Frequency { 973 class _Frequency {
974 /** Every call/throw must match */ 974 /** Every call/throw must match */
975 static final ALL = const _Frequency._('ALL'); 975 static const ALL = const _Frequency._('ALL');
976 976
977 /** At least one call/throw must match. */ 977 /** At least one call/throw must match. */
978 static final SOME = const _Frequency._('SOME'); 978 static const SOME = const _Frequency._('SOME');
979 979
980 /** No calls/throws should match. */ 980 /** No calls/throws should match. */
981 static final NONE = const _Frequency._('NONE'); 981 static const NONE = const _Frequency._('NONE');
982 982
983 const _Frequency._(this.name); 983 const _Frequency._(this.name);
984 984
985 final String name; 985 final String name;
986 } 986 }
987 987
988 /** 988 /**
989 * [_ResultSetMatcher]s are used to make assertions about the results 989 * [_ResultSetMatcher]s are used to make assertions about the results
990 * of method calls. When filtering an execution log by calling 990 * of method calls. When filtering an execution log by calling
991 * [getLogs], a [LogEntrySet] of matching call logs is returned; 991 * [getLogs], a [LogEntrySet] of matching call logs is returned;
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 } 1450 }
1451 } 1451 }
1452 } 1452 }
1453 1453
1454 /** Clear both logs and behavior. */ 1454 /** Clear both logs and behavior. */
1455 void reset() { 1455 void reset() {
1456 resetBehavior(); 1456 resetBehavior();
1457 clearLogs(); 1457 clearLogs();
1458 } 1458 }
1459 } 1459 }
OLDNEW
« no previous file with comments | « pkg/unittest/interactive_html_config.dart ('k') | pkg/unittest/numeric_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698