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

Unified Diff: pkg/unittest/unittest.dart

Issue 10944006: - Removed comment to Frog and eliminated usage of sentinel. (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 side-by-side diff with in-line comments
Download patch
« pkg/unittest/mock.dart ('K') | « pkg/unittest/mock.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/unittest.dart
===================================================================
--- pkg/unittest/unittest.dart (revision 12478)
+++ pkg/unittest/unittest.dart (working copy)
@@ -293,15 +293,6 @@
_tests.add(_soloTest);
}
-/** Sentinel value for [_SpreadArgsHelper]. */
-class _Sentinel {
- const _Sentinel();
-}
-
-// TODO(sigmund): make a singleton const field when frog supports passing those
-// as default values to named arguments.
-const _sentinel = const _Sentinel();
-
/** Simulates spread arguments using named arguments. */
// TODO(sigmund): remove this class and simply use a closure with named
// arguments (if still applicable).
@@ -365,30 +356,21 @@
}
}
- invoke([arg0 = _sentinel, arg1 = _sentinel, arg2 = _sentinel,
- arg3 = _sentinel, arg4 = _sentinel]) {
+ invoke([arg0, arg1, arg2, arg3, arg4]) {
return guardAsync(() {
++_actualCalls;
- if (!_shouldCallBack()) {
- return;
- } else if (arg0 == _sentinel) {
- return _callback();
- } else if (arg1 == _sentinel) {
- return _callback(arg0);
- } else if (arg2 == _sentinel) {
- return _callback(arg0, arg1);
- } else if (arg3 == _sentinel) {
- return _callback(arg0, arg1, arg2);
- } else if (arg4 == _sentinel) {
- return _callback(arg0, arg1, arg2, arg3);
- } else {
- _testCase.error(
- 'unittest lib does not support callbacks with more than'
- ' 4 arguments.',
- '');
- }
- },
- _after, _testNum);
+ if (!_shouldCallBack()) return;
+ if (?arg0) return _callback();
kasperl 2012/09/18 10:52:25 !?arg0
+ if (?arg1) return _callback(arg0);
+ if (?arg2) return _callback(arg0, arg1);
+ if (?arg3) return _callback(arg0, arg1, arg2);
+ if (?arg4) return _callback(arg0, arg1, arg2, arg3);
+ _testCase.error(
+ 'unittest lib does not support callbacks with more than'
+ ' 4 arguments.',
+ '');
+ },
+ _after, _testNum);
}
invoke0() {
« pkg/unittest/mock.dart ('K') | « pkg/unittest/mock.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698