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

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

Issue 12217142: Unit test improvements: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 * A library for writing dart unit tests. 6 * A library for writing dart unit tests.
7 * 7 *
8 * To import this library, use the pub package manager. 8 * To import this library, use the pub package manager.
9 * Create a pubspec.yaml file in your project and add 9 * Create a pubspec.yaml file in your project and add
10 * a dependency on unittest with the following lines: 10 * a dependency on unittest with the following lines:
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 _callback = callback; 347 _callback = callback;
348 _shouldCallBack = shouldCallBack; 348 _shouldCallBack = shouldCallBack;
349 _isDone = isDone; 349 _isDone = isDone;
350 _expectedCalls = expectedCalls; 350 _expectedCalls = expectedCalls;
351 _testNum = _currentTest; 351 _testNum = _currentTest;
352 _testCase = _tests[_currentTest]; 352 _testCase = _tests[_currentTest];
353 if (expectedCalls > 0) { 353 if (expectedCalls > 0) {
354 _testCase.callbackFunctionsOutstanding++; 354 _testCase.callbackFunctionsOutstanding++;
355 } 355 }
356 _id = ''; 356 _id = '';
357 // If the callback is not an anonymous closure, try to get the
358 // name.
359 var fname = callback.toString();
360 var prefix = "Function '";
361 var pos = fname.indexOf(prefix);
362 if (pos > 0) {
363 pos += prefix.length;
364 var epos = fname.indexOf("'", pos);
365 if (epos > 0) {
366 _id = "${fname.substring(pos, epos)} ";
367 }
368 }
357 } 369 }
358 370
359 _SpreadArgsHelper(callback, shouldCallBack, isDone) { 371 _SpreadArgsHelper(callback, shouldCallBack, isDone) {
360 _init(callback, shouldCallBack, isDone); 372 _init(callback, shouldCallBack, isDone);
361 } 373 }
362 374
363 _SpreadArgsHelper.fixedCallCount(callback, expectedCalls, id) { 375 _SpreadArgsHelper.fixedCallCount(callback, expectedCalls, id) {
364 _init(callback, _checkCallCount, _allCallsDone, expectedCalls); 376 _init(callback, _checkCallCount, _allCallsDone, expectedCalls);
365 if (id != null) { 377 if (id != null) {
366 _id = "$id "; 378 _id = "$id ";
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 924 }
913 925
914 /** Enable a test by ID. */ 926 /** Enable a test by ID. */
915 void enableTest(int testId) => _setTestEnabledState(testId, true); 927 void enableTest(int testId) => _setTestEnabledState(testId, true);
916 928
917 /** Disable a test by ID. */ 929 /** Disable a test by ID. */
918 void disableTest(int testId) => _setTestEnabledState(testId, false); 930 void disableTest(int testId) => _setTestEnabledState(testId, false);
919 931
920 /** Signature for a test function. */ 932 /** Signature for a test function. */
921 typedef void TestFunction(); 933 typedef void TestFunction();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698