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

Unified Diff: pkg/unittest/lib/unittest.dart

Issue 12452004: pkg/unittest: locking down TestCase (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixed up dartdoc on TestCase and updated copyright year Created 7 years, 10 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/lib/src/test_case.dart ('K') | « pkg/unittest/lib/src/test_case.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/unittest.dart
diff --git a/pkg/unittest/lib/unittest.dart b/pkg/unittest/lib/unittest.dart
index 1177de50e7c22756fab2310c4acdbb49674d3d49..ce37057ef8893d4073500df4e710a474333f68db 100644
--- a/pkg/unittest/lib/unittest.dart
+++ b/pkg/unittest/lib/unittest.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -258,7 +258,7 @@ Map testState = {};
*/
void test(String spec, TestFunction body) {
ensureInitialized();
- _tests.add(new TestCase(_tests.length + 1, _fullSpec(spec), body, 0));
+ _tests.add(new TestCase._internal(_tests.length + 1, _fullSpec(spec), body));
}
/**
@@ -280,7 +280,7 @@ void solo_test(String spec, TestFunction body) {
ensureInitialized();
- _soloTest = new TestCase(_tests.length + 1, _fullSpec(spec), body, 0);
+ _soloTest = new TestCase._internal(_tests.length + 1, _fullSpec(spec), body);
_tests.add(_soloTest);
}
@@ -326,7 +326,7 @@ class _SpreadArgsHelper {
_tests[_currentTest] != null);
testCase = _tests[_currentTest];
if (isDone != null || minExpected > 0) {
- testCase.callbackFunctionsOutstanding++;
+ testCase._callbackFunctionsOutstanding++;
complete = false;
} else {
complete = true;
@@ -361,7 +361,7 @@ class _SpreadArgsHelper {
// the current test, but we do mark the old test as having an error
// if it previously passed.
if (testCase.result == PASS) {
- testCase.error(
+ testCase._error(
'Callback ${id}called ($actualCalls) after test case '
'${testCase.description} has already been marked as '
'${testCase.result}.', '');
@@ -382,7 +382,7 @@ class _SpreadArgsHelper {
// Mark this callback as complete and remove it from the testcase
// oustanding callback count; if that hits zero the testcase is done.
complete = true;
- testCase.markCallbackComplete();
+ testCase._markCallbackComplete();
}
}
@@ -402,7 +402,7 @@ class _SpreadArgsHelper {
} else if (arg4 == sentinel) {
return callback(arg0, arg1, arg2, arg3);
} else {
- testCase.error(
+ testCase._error(
'unittest lib does not support callbacks with more than'
' 4 arguments.',
'');
@@ -655,7 +655,7 @@ void _nextTestCase() {
void _reportTestError(String msg, String trace) {
if (_currentTest < _tests.length) {
final testCase = _tests[_currentTest];
- testCase.error(msg, trace);
+ testCase._error(msg, trace);
} else {
_uncaughtErrorMessage = "$msg: $trace";
}
@@ -750,9 +750,9 @@ _registerException(testNum, e, [trace]) {
trace = trace == null ? '' : trace.toString();
String message = (e is TestFailure) ? e.message : 'Caught $e';
if (_tests[testNum].result == null) {
- _tests[testNum].fail(message, trace);
+ _tests[testNum]._fail(message, trace);
} else {
- _tests[testNum].error(message, trace);
+ _tests[testNum]._error(message, trace);
}
}
@@ -768,7 +768,7 @@ _nextBatch() {
break;
}
final testCase = _tests[_currentTest];
- var f = _guardAsync(testCase.run, null, _currentTest);
+ var f = _guardAsync(testCase._run, null, _currentTest);
if (f != null) {
f.whenComplete(() {
_nextTestCase(); // Schedule the next test.
@@ -845,11 +845,11 @@ void setSoloTest(int id) {
void _setTestEnabledState(int testId, bool state) {
// Try fast path first.
if (_tests.length > testId && _tests[testId].id == testId) {
- _tests[testId].enabled = state;
+ _tests[testId]._enabled = state;
} else {
for (var i = 0; i < _tests.length; i++) {
if (_tests[i].id == testId) {
- _tests[i].enabled = state;
+ _tests[i]._enabled = state;
break;
}
}
« pkg/unittest/lib/src/test_case.dart ('K') | « pkg/unittest/lib/src/test_case.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698