diff --git a/codereview.settings b/codereview.settings index 9b36242840faf42f7879e37a18f18efec2fac9ef..bd401b14c414da72c350d48165fdf5fbc25783bc 100644 --- a/codereview.settings +++ b/codereview.settings @@ -1,3 +1,3 @@ -CODE_REVIEW_SERVER: http://codereview.chromium.org/ +CODE_REVIEW_SERVER: https://codereview.chromium.org/ VIEW_VC: https://github.com/dart-lang/unittest/commit/ CC_LIST: reviews@dartlang.org \ No newline at end of file diff --git a/lib/compact_vm_config.dart b/lib/compact_vm_config.dart index aee1405da0b7ed912c1c820bcd9d97ce88d40359..d9bc0b4b1cb3d5fb12c54b5f67ffeba699f45f18 100644 --- a/lib/compact_vm_config.dart +++ b/lib/compact_vm_config.dart @@ -134,7 +134,8 @@ class CompactVMConfiguration extends VMConfiguration { // Ensure the line fits under MAX_LINE. [buffer] includes the color escape // sequences too. Because these sequences are not visible characters, we // make sure they are not counted towards the limit. - int nonVisible = _nonVisiblePrefix + color.length + + int nonVisible = _nonVisiblePrefix + + color.length + (_fail != 0 ? (_RED.length + _NONE.length) : 0); int len = buffer.length - nonVisible; var mx = MAX_LINE - len; @@ -155,7 +156,7 @@ class CompactVMConfiguration extends VMConfiguration { } String _padTime(int time) => - (time == 0) ? '00' : ((time < 10) ? '0$time' : '$time'); + (time == 0) ? '00' : ((time < 10) ? '0$time' : '$time'); String _timeString(Duration duration) { var min = duration.inMinutes; @@ -181,7 +182,7 @@ class CompactVMConfiguration extends VMConfiguration { var buffer = new StringBuffer(); buffer.write(words.first); buffer.write(' ...'); - for (; i < words.length; i++) { + for ( ; i < words.length; i++) { buffer.write(' '); buffer.write(words[i]); } diff --git a/lib/html_config.dart b/lib/html_config.dart index b132be871593c64ade5728a4b087afa368fc962e..210f0f5e0d68696cebc93a26f26d7271370e1fd2 100644 --- a/lib/html_config.dart +++ b/lib/html_config.dart @@ -98,17 +98,16 @@ class HtmlConfiguration extends SimpleConfiguration { void _installHandlers() { if (_onErrorSubscription == null) { - _onErrorSubscription = window.onError.listen( - (e) { - // Some tests may expect this and have no way to suppress the error. - if (js.context['testExpectsGlobalError'] != true) { - handleExternalError(e, '(DOM callback has errors)'); - } - }); + _onErrorSubscription = window.onError.listen((e) { + // Some tests may expect this and have no way to suppress the error. + if (js.context['testExpectsGlobalError'] != true) { + handleExternalError(e, '(DOM callback has errors)'); + } + }); } if (_onMessageSubscription == null) { - _onMessageSubscription = window.onMessage.listen( - (e) => processMessage(e)); + _onMessageSubscription = + window.onMessage.listen((e) => processMessage(e)); } } @@ -133,8 +132,8 @@ class HtmlConfiguration extends SimpleConfiguration { // For Dart internal tests, we want to turn off stack frame // filtering, which we do with this meta-header. var meta = querySelector('meta[name="dart.unittest"]'); - filterStacks = meta == null ? true : - !meta.content.contains('full-stack-traces'); + filterStacks = + meta == null ? true : !meta.content.contains('full-stack-traces'); _installHandlers(); window.postMessage('unittest-suite-wait-for-done', '*'); } @@ -158,8 +157,8 @@ class HtmlConfiguration extends SimpleConfiguration { void onSummary(int passed, int failed, int errors, List<TestCase> results, String uncaughtError) { - _showResultsInPage(passed, failed, errors, results, _isLayoutTest, - uncaughtError); + _showResultsInPage( + passed, failed, errors, results, _isLayoutTest, uncaughtError); } void onDone(bool success) { diff --git a/lib/html_enhanced_config.dart b/lib/html_enhanced_config.dart index c83330c2178ce9ab6c55b12988730ef3adab9f7c..2330d6571b1647ff4bebbabb3347f5ebc5711657 100644 --- a/lib/html_enhanced_config.dart +++ b/lib/html_enhanced_config.dart @@ -24,16 +24,16 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { void _installOnErrorHandler() { if (_onErrorSubscription == null) { // Listen for uncaught errors. - _onErrorSubscription = window.onError.listen( - (e) => handleExternalError(e, '(DOM callback has errors)')); + _onErrorSubscription = window.onError + .listen((e) => handleExternalError(e, '(DOM callback has errors)')); } } void _installOnMessageHandler() { if (_onMessageSubscription == null) { // Listen for errors from JS. - _onMessageSubscription = window.onMessage.listen( - (e) => processMessage(e)); + _onMessageSubscription = + window.onMessage.listen((e) => processMessage(e)); } } @@ -82,8 +82,8 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { void onSummary(int passed, int failed, int errors, List<TestCase> results, String uncaughtError) { - _showInteractiveResultsInPage(passed, failed, errors, results, - _isLayoutTest, uncaughtError); + _showInteractiveResultsInPage( + passed, failed, errors, results, _isLayoutTest, uncaughtError); } void onDone(bool success) { @@ -109,7 +109,6 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { te.children.add(new Element.html(""" <div class='unittest-pass'>All ${passed} tests passed</div>""")); } else { - if (uncaughtError != null) { te.children.add(new Element.html(""" <div class='unittest-summary'> @@ -131,11 +130,11 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { """)); // handle the click event for the collapse all button - te.querySelector('#btnCollapseAll').onClick.listen((_){ + te.querySelector('#btnCollapseAll').onClick.listen((_) { document - .querySelectorAll('.unittest-row') - .forEach((el) => el.attributes['class'] = el.attributes['class'] - .replaceAll('unittest-row ', 'unittest-row-hidden ')); + .querySelectorAll('.unittest-row') + .forEach((el) => el.attributes['class'] = el.attributes['class'] + .replaceAll('unittest-row ', 'unittest-row-hidden ')); }); var previousGroup = ''; @@ -156,13 +155,10 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { // flatten the list again with tests ordered List<TestCase> flattened = new List<TestCase>(); - groupedBy - .values - .forEach((tList){ - tList.sort((tcA, tcB) => tcA.id - tcB.id); - flattened.addAll(tList); - } - ); + groupedBy.values.forEach((tList) { + tList.sort((tcA, tcB) => tcA.id - tcB.id); + flattened.addAll(tList); + }); var nonAlphanumeric = new RegExp('[^a-z0-9A-Z]'); @@ -174,15 +170,14 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { var safeGroup = test_.currentGroup.replaceAll(nonAlphanumeric, '_'); if (test_.currentGroup != previousGroup) { - previousGroup = test_.currentGroup; var testsInGroup = results .where((TestCase t) => t.currentGroup == previousGroup) .toList(); var groupTotalTestCount = testsInGroup.length; - var groupTestPassedCount = testsInGroup.where( - (TestCase t) => t.result == 'pass').length; + var groupTestPassedCount = + testsInGroup.where((TestCase t) => t.result == 'pass').length; groupPassFail = groupTotalTestCount == groupTestPassedCount; var passFailClass = "unittest-group-status unittest-group-" "status-${groupPassFail ? 'pass' : 'fail'}"; @@ -204,16 +199,16 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { </div>""")); // 'safeGroup' could be empty - var grp = (safeGroup == '') ? - null : te.querySelector('#${safeGroup}'); + var grp = + (safeGroup == '') ? null : te.querySelector('#${safeGroup}'); if (grp != null) { grp.onClick.listen((_) { var row = document.querySelector('.unittest-row-${safeGroup}'); - if (row.attributes['class'].contains('unittest-row ')){ + if (row.attributes['class'].contains('unittest-row ')) { document.querySelectorAll('.unittest-row-${safeGroup}').forEach( - (e) => e.attributes['class'] = e.attributes['class'] + (e) => e.attributes['class'] = e.attributes['class'] .replaceAll('unittest-row ', 'unittest-row-hidden ')); - }else{ + } else { document.querySelectorAll('.unittest-row-${safeGroup}').forEach( (e) => e.attributes['class'] = e.attributes['class'] .replaceAll('unittest-row-hidden', 'unittest-row')); @@ -234,10 +229,8 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { var background = 'unittest-row-${test_.id % 2 == 0 ? "even" : "odd"}'; var display = '${isVisible ? "unittest-row" : "unittest-row-hidden"}'; - addRowElement(id, status, description){ - te.children.add( - new Element.html( - ''' <div> + addRowElement(id, status, description) { + te.children.add(new Element.html(''' <div> <div class='$display unittest-row-${groupID} $background'> <div ${_isIE ? "style='display:inline-block' ": ""} class='unittest-row-id'>$id</div> @@ -247,9 +240,7 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { <div ${_isIE ? "style='display:inline-block' ": ""} class='unittest-row-description'>$description</div> </div> - </div>''' - ) - ); + </div>''')); } if (!test_.isComplete) { @@ -266,15 +257,13 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { } } - static bool get _isIE => window.navigator.userAgent.contains('MSIE'); - String get _htmlTestCSS => - ''' + String get _htmlTestCSS => ''' body{ font-size: 14px; font-family: 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',''' - ''' sans-serif; + ''' sans-serif; background: WhiteSmoke; } @@ -292,13 +281,13 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { ${_isIE ? "border-top:solid #777777 1px;": ""} background-image: -webkit-linear-gradient(bottom, rgb(50,50,50) 0%, ''' - '''rgb(100,100,100) 100%); + '''rgb(100,100,100) 100%); background-image: -moz-linear-gradient(bottom, rgb(50,50,50) 0%, ''' - '''rgb(100,100,100) 100%); + '''rgb(100,100,100) 100%); background-image: -ms-linear-gradient(bottom, rgb(50,50,50) 0%, ''' - '''rgb(100,100,100) 100%); + '''rgb(100,100,100) 100%); background-image: linear-gradient(bottom, rgb(50,50,50) 0%, ''' - '''rgb(100,100,100) 100%); + '''rgb(100,100,100) 100%); display: -webkit-box; display: -moz-box; @@ -327,23 +316,23 @@ class HtmlEnhancedConfiguration extends SimpleConfiguration { .unittest-group-status-pass{ background: Green; background: ''' - '''-webkit-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); + '''-webkit-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); background: ''' - '''-moz-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); + '''-moz-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); background: ''' - '''-ms-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); + '''-ms-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); background: ''' - '''radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); + '''radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); } .unittest-group-status-fail{ background: Red; background: ''' - '''-webkit-radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%); + '''-webkit-radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%); background: ''' - '''-moz-radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%); + '''-moz-radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%); background: ''' - '''-ms-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); + '''-ms-radial-gradient(center, ellipse cover, #AAFFAA 0%,Green 100%); background: radial-gradient(center, ellipse cover, #FFAAAA 0%,Red 100%); } diff --git a/lib/html_individual_config.dart b/lib/html_individual_config.dart index 85b67a0bcbc0f945422d7712e2e578baf85fa42e..263adf983aabefcaca194ade515c79bc27902752 100644 --- a/lib/html_individual_config.dart +++ b/lib/html_individual_config.dart @@ -17,12 +17,14 @@ import 'unittest.dart' as unittest; import 'html_config.dart' as htmlconfig; class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration { - HtmlIndividualConfiguration(bool isLayoutTest): super(isLayoutTest); + HtmlIndividualConfiguration(bool isLayoutTest) : super(isLayoutTest); void onStart() { var search = window.location.search; if (search != '') { - var groups = search.substring(1).split('&') + var groups = search + .substring(1) + .split('&') .where((p) => p.startsWith('group=')) .toList(); @@ -33,8 +35,8 @@ class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration { var testGroupName = groups.single.split('=')[1]; var startsWith = "$testGroupName${unittest.groupSep}"; - unittest.filterTests((unittest.TestCase tc) => - tc.description.startsWith(startsWith)); + unittest.filterTests( + (unittest.TestCase tc) => tc.description.startsWith(startsWith)); } } super.onStart(); @@ -42,7 +44,8 @@ class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration { } void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { - unittest.unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonNotLayout; + unittest.unittestConfiguration = + isLayoutTest ? _singletonLayout : _singletonNotLayout; } final _singletonLayout = new HtmlIndividualConfiguration(true); diff --git a/lib/src/configuration.dart b/lib/src/configuration.dart index ca901328cdc3e32cdd7652bd9d13059b3b38d93f..f4a28c989c73067c370ad45524ab30ff4861bc4f 100644 --- a/lib/src/configuration.dart +++ b/lib/src/configuration.dart @@ -66,4 +66,3 @@ abstract class Configuration { void onSummary(int passed, int failed, int errors, List<TestCase> results, String uncaughtError) {} } - diff --git a/lib/src/simple_configuration.dart b/lib/src/simple_configuration.dart index aa249778fa4a8ca9e5c455669d3861e625bbc599..6254bf5951dd3661be9848d2a0e56910ec214b06 100644 --- a/lib/src/simple_configuration.dart +++ b/lib/src/simple_configuration.dart @@ -46,7 +46,7 @@ class SimpleConfiguration extends Configuration { /// The constructor sets up a failure handler for [expect] that redirects /// [expect] failures to [onExpectFailure]. - SimpleConfiguration(): super.blank() { + SimpleConfiguration() : super.blank() { configureExpectFailureHandler(new _ExpectFailureHandler(this)); } @@ -75,8 +75,8 @@ class SimpleConfiguration extends Configuration { if (!stopTestOnExpectFailure && _testLogBuffer.length > 0) { // Write the message/stack pairs up to the last pairs. var reason = new StringBuffer(); - for (var reasonAndTrace in - _testLogBuffer.take(_testLogBuffer.length - 1)) { + for (var reasonAndTrace + in _testLogBuffer.take(_testLogBuffer.length - 1)) { reason.write(reasonAndTrace.first); reason.write('\n'); reason.write(reasonAndTrace.last); diff --git a/lib/src/spread_args_helper.dart b/lib/src/spread_args_helper.dart index 554dcf64c458d7111313299959d8c1af3f20a99d..f93e9ba6133e4e569c9fe39f707d0ab374140fc1 100644 --- a/lib/src/spread_args_helper.dart +++ b/lib/src/spread_args_helper.dart @@ -72,15 +72,14 @@ 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( - 'Callback ${id}called ($actualCalls) after test case ' + testCase._error('Callback ${id}called ($actualCalls) after test case ' '${testCase.description} has already been marked as ' '${testCase.result}.$reason'); } return false; } else if (maxExpectedCalls >= 0 && actualCalls > maxExpectedCalls) { throw new TestFailure('Callback ${id}called more times than expected ' - '($maxExpectedCalls).$reason'); + '($maxExpectedCalls).$reason'); } return true; } @@ -136,13 +135,11 @@ class _SpreadArgsHelper { var args = [a0, a1, a2, a3, a4, a5]; args.removeWhere((a) => a == _PLACE_HOLDER); - return _guardAsync( - () { - if (shouldCallBack()) { - return Function.apply(callback, args); - } - }, - after, testCase); + return _guardAsync(() { + if (shouldCallBack()) { + return Function.apply(callback, args); + } + }, after, testCase); } _guardAsync(Function tryBody, Function finallyBody, TestCase testCase) { diff --git a/lib/src/test_case.dart b/lib/src/test_case.dart index fc84ed7e7d03326f40604371ea788b3abc569808..a365cc662b42eea3c73c05b8c988d200c2514f42 100644 --- a/lib/src/test_case.dart +++ b/lib/src/test_case.dart @@ -104,7 +104,8 @@ class TestCase { // would a callback, so if a failure occurs while waiting, we can abort. if (testReturn is Future) { ++_callbackFunctionsOutstanding; - testReturn.catchError(_errorHandler('Test')) + testReturn + .catchError(_errorHandler('Test')) .whenComplete(_markCallbackComplete); } }).catchError(_errorHandler('Test')).then((_) { @@ -142,8 +143,8 @@ class TestCase { } } - void _complete(String testResult, [String messageText = '', - StackTrace stack]) { + void _complete(String testResult, + [String messageText = '', StackTrace stack]) { if (runningTime == null) { // The startTime can be `null` if an error happened during setup. In this // case we simply report a running time of 0. diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 877cfb2263bacbd10358da47ac2e77d74a963d99..ea1e92ea7d939bcd7be3812ad1e1fe8371fb9977 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -8,7 +8,7 @@ import 'package:stack_trace/stack_trace.dart'; /// Indent each line in [str] by two spaces. String indent(String str) => - str.replaceAll(new RegExp("^", multiLine: true), " "); + str.replaceAll(new RegExp("^", multiLine: true), " "); /// A pair of values. class Pair<E, F> { diff --git a/lib/unittest.dart b/lib/unittest.dart index 14b3af66ba4c4d1bf05dcd54f13345be1954c08e..72b5ea7deeab4d909dbddc5c3d51b2cfeb7d992f 100644 --- a/lib/unittest.dart +++ b/lib/unittest.dart @@ -138,8 +138,12 @@ import 'dart:async'; import 'dart:collection'; import 'dart:isolate'; -import 'package:matcher/matcher.dart' show DefaultFailureHandler, - configureExpectFailureHandler, TestFailure, wrapAsync; +import 'package:matcher/matcher.dart' + show + DefaultFailureHandler, + configureExpectFailureHandler, + TestFailure, + wrapAsync; export 'package:matcher/matcher.dart'; import 'src/utils.dart'; @@ -219,11 +223,10 @@ List<TestCase> get testCases => const int BREATH_INTERVAL = 200; /// [TestCase] currently being executed. -TestCase get currentTestCase => - (_environment.currentTestCaseIndex >= 0 && - _environment.currentTestCaseIndex < testCases.length) - ? testCases[_environment.currentTestCaseIndex] - : null; +TestCase get currentTestCase => (_environment.currentTestCaseIndex >= 0 && + _environment.currentTestCaseIndex < testCases.length) + ? testCases[_environment.currentTestCaseIndex] + : null; /* Test case result strings. */ // TODO(gram) we should change these constants to use a different string @@ -244,8 +247,8 @@ void test(String spec, TestFunction body) { _requireNotRunning(); ensureInitialized(); if (!_environment.soloTestSeen || _environment.soloNestingLevel > 0) { - var testcase = new TestCase._internal(testCases.length + 1, _fullSpec(spec), - body); + var testcase = + new TestCase._internal(testCases.length + 1, _fullSpec(spec), body); _testCases.add(testcase); } } @@ -306,7 +309,7 @@ void solo_test(String spec, TestFunction body) { /// generated reason. Function expectAsync(Function callback, {int count: 1, int max: 0, String id, String reason}) => - new _SpreadArgsHelper(callback, count, max, id, reason).func; + new _SpreadArgsHelper(callback, count, max, id, reason).func; /// Indicate that [callback] is expected to be called until [isDone] returns /// true. @@ -324,7 +327,7 @@ Function expectAsync(Function callback, /// generated reason. Function expectAsyncUntil(Function callback, bool isDone(), {String id, String reason}) => - new _SpreadArgsHelper(callback, 0, -1, id, reason, isDone: isDone).func; + new _SpreadArgsHelper(callback, 0, -1, id, reason, isDone: isDone).func; /// Creates a new named group of tests. /// @@ -500,14 +503,22 @@ void _completeTests() { for (TestCase t in testCases) { switch (t.result) { - case PASS: passed++; break; - case FAIL: failed++; break; - case ERROR: errors++; break; + case PASS: + passed++; + break; + case FAIL: + failed++; + break; + case ERROR: + errors++; + break; } } - _config.onSummary(passed, failed, errors, testCases, - _environment.uncaughtErrorMessage); - _config.onDone(passed > 0 && failed == 0 && errors == 0 && + _config.onSummary( + passed, failed, errors, testCases, _environment.uncaughtErrorMessage); + _config.onDone(passed > 0 && + failed == 0 && + errors == 0 && _environment.uncaughtErrorMessage == null); _environment.initialized = false; _environment.currentTestCaseIndex = -1; diff --git a/pubspec.yaml b/pubspec.yaml index 6b0dca5f25c2e9b8852b218a650b8654ed7e8b9b..2277d67b6b8efb0626248c352d8688f1c3e638ea 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: unittest -version: 0.11.4 +version: 0.11.5-dev author: Dart Team <misc@dartlang.org> description: A library for writing dart unit tests. homepage: https://github.com/dart-lang/unittest diff --git a/test/async_exception_with_future_test.dart b/test/async_exception_with_future_test.dart index 7dd8515db9d40374a2cef202c0cadc73cca7c916..c5c445e12475fee3ba2c9d8d252e578f5ac370ef 100644 --- a/test/async_exception_with_future_test.dart +++ b/test/async_exception_with_future_test.dart @@ -35,13 +35,8 @@ void _test(message) { test('follow up', () { expect(tearDownHappened, isTrue); }); - - }, [{ - 'description': 'test', - 'message': 'Caught error!', - 'result': 'fail', - }, { - 'description': 'follow up', - 'result': 'pass', - }]); + }, [ + {'description': 'test', 'message': 'Caught error!', 'result': 'fail',}, + {'description': 'follow up', 'result': 'pass',} + ]); } diff --git a/test/async_setup_teardown_test.dart b/test/async_setup_teardown_test.dart index c9138d01f772e86a0030dd35ca57541211036889..1068ee7025d03377a5dca0783a119d81a9f97050 100644 --- a/test/async_setup_teardown_test.dart +++ b/test/async_setup_teardown_test.dart @@ -32,10 +32,12 @@ void _test(message) { return new Future.error("Failed to complete tearDown"); }); test('foo2', () {}); - }, [{ - 'result': 'error', - 'message': 'Teardown failed: Caught Failed to complete tearDown' - }]); + }, [ + { + 'result': 'error', + 'message': 'Teardown failed: Caught Failed to complete tearDown' + } + ]); expectTestResults('bad setup/good teardown', () { setUp(() { @@ -45,10 +47,12 @@ void _test(message) { return new Future.value(0); }); test('foo3', () {}); - }, [{ - 'result': 'error', - 'message': 'Setup failed: Caught Failed to complete setUp' - }]); + }, [ + { + 'result': 'error', + 'message': 'Setup failed: Caught Failed to complete setUp' + } + ]); expectTestResults('bad setup/bad teardown', () { setUp(() { @@ -58,8 +62,10 @@ void _test(message) { return new Future.error("Failed to complete tearDown"); }); test('foo4', () {}); - }, [{ - 'result': 'error', - 'message': 'Setup failed: Caught Failed to complete setUp' - }]); + }, [ + { + 'result': 'error', + 'message': 'Setup failed: Caught Failed to complete setUp' + } + ]); } diff --git a/test/exception_test.dart b/test/exception_test.dart index 023ab287d16c5cbb0c70f5c8b66627a56a88d076..137f0a3661108d40df7c58f49cf3b718343d6393 100644 --- a/test/exception_test.dart +++ b/test/exception_test.dart @@ -17,8 +17,5 @@ void _test(message) { test('test', () { throw new Exception('Fail.'); }); - }, [{ - 'result': 'error', - 'message': 'Test failed: Caught Exception: Fail.' - }]); + }, [{'result': 'error', 'message': 'Test failed: Caught Exception: Fail.'}]); } diff --git a/test/excess_callback_test.dart b/test/excess_callback_test.dart index 45dca37e3f98160d6d69ec95aa171dd1faccbcf1..2679d17e202d0b706cb35b201c02d6034c6dcbfb 100644 --- a/test/excess_callback_test.dart +++ b/test/excess_callback_test.dart @@ -31,12 +31,12 @@ void _test(message) { test('verify count', () { expect(count, 1); }); - }, [{ - 'description': 'test', - 'message': 'Callback called more times than expected (1).', - 'result': 'fail' - }, { - 'description': 'verify count', - 'result': 'pass', - }]); + }, [ + { + 'description': 'test', + 'message': 'Callback called more times than expected (1).', + 'result': 'fail' + }, + {'description': 'verify count', 'result': 'pass',} + ]); } diff --git a/test/expect_async_args_test.dart b/test/expect_async_args_test.dart index a7e6e21d8b4c34cbcc5d31fc34546045a47e12c9..8e814dc9b83191e62e8e19a34e1c2ccba7252a0f 100644 --- a/test/expect_async_args_test.dart +++ b/test/expect_async_args_test.dart @@ -39,17 +39,10 @@ void _test(message) { test('verify count', () { expect(count, 3); }); - }, [{ - 'description': 'expect async args', - 'result': 'pass', - }, { - 'description': 'invoked with too many args', - 'result': 'error', - }, { - 'description': 'created with too many args', - 'result': 'error', - }, { - 'description': 'verify count', - 'result': 'pass', - }]); + }, [ + {'description': 'expect async args', 'result': 'pass',}, + {'description': 'invoked with too many args', 'result': 'error',}, + {'description': 'created with too many args', 'result': 'error',}, + {'description': 'verify count', 'result': 'pass',} + ]); } diff --git a/test/group_name_test.dart b/test/group_name_test.dart index b833006d28602fcca47f911a429f263851bbbe6d..3184ffc3f8e954ce4c817bdcb5970f8c2a7878d2 100644 --- a/test/group_name_test.dart +++ b/test/group_name_test.dart @@ -20,9 +20,5 @@ void _test(message) { test('b', () {}); }); }); - }, [{ - 'description': 'a a' - }, { - 'description': 'a b b' - }]); + }, [{'description': 'a a'}, {'description': 'a b b'}]); } diff --git a/test/late_exception_test.dart b/test/late_exception_test.dart index 777085d2f55bdbcbb3fc368571302850a3c3618b..14d14fe742e2492a3023526bae18fedc05241ea3 100644 --- a/test/late_exception_test.dart +++ b/test/late_exception_test.dart @@ -25,13 +25,13 @@ void _test(message) { f(); })); }); - }, [{ - 'description': 'testOne', - 'message': 'Callback called (2) after test case testOne has already been ' - 'marked as pass.', - 'result': 'error', - }, { - 'description': 'testTwo', - 'result': 'pass', - }]); + }, [ + { + 'description': 'testOne', + 'message': 'Callback called (2) after test case testOne has already been ' + 'marked as pass.', + 'result': 'error', + }, + {'description': 'testTwo', 'result': 'pass',} + ]); } diff --git a/test/middle_exception_test.dart b/test/middle_exception_test.dart index ba2d0d0942234370729f82d510de3912d915f029..1abd02e2df2f9a15dc96701a955b257a302f4f05 100644 --- a/test/middle_exception_test.dart +++ b/test/middle_exception_test.dart @@ -28,11 +28,5 @@ void _test(message) { done(); }); }); - }, [{ - 'result': 'pass' - }, { - 'result': 'fail', - }, { - 'result': 'pass' - }]); + }, [{'result': 'pass'}, {'result': 'fail',}, {'result': 'pass'}]); } diff --git a/test/missing_tick_test.dart b/test/missing_tick_test.dart index bffd0affde205b507f3c51c0f7a927cc7d8fc279..81b033153206068b3f3267ca9e897721640252a1 100644 --- a/test/missing_tick_test.dart +++ b/test/missing_tick_test.dart @@ -14,13 +14,14 @@ void _test(message) { initMetatest(message, timeout: const Duration(seconds: 1)); expectTestResults('missing tick', () { - test('test that should time out', () { expectAsync(() {}); }); - }, [{ - 'description': 'test that should time out', - 'message': 'Test timed out after 1 seconds.', - 'result': 'error', - }]); + }, [ + { + 'description': 'test that should time out', + 'message': 'Test timed out after 1 seconds.', + 'result': 'error', + } + ]); } diff --git a/test/nested_groups_setup_teardown_test.dart b/test/nested_groups_setup_teardown_test.dart index 212c9a881afe19e8fb8ebc363ded251341b65789..ca09ec62cf1f07c6ecce1c92548730952692ccec 100644 --- a/test/nested_groups_setup_teardown_test.dart +++ b/test/nested_groups_setup_teardown_test.dart @@ -43,7 +43,6 @@ void _test(message) { }); } - Function makeDelayedSetup(int index, StringBuffer s) => () { return new Future.delayed(new Duration(milliseconds: 1), () { s.write('l$index U '); diff --git a/test/protect_async_test.dart b/test/protect_async_test.dart index d62816aada880b2e972dbc113dc779077e25bb8b..19211f2bb3e83a860747f78c31c348930500847a 100644 --- a/test/protect_async_test.dart +++ b/test/protect_async_test.dart @@ -40,17 +40,19 @@ void _test(message) { test('throw away 1', () { return new Future(() {}); }); - }, [{ - 'result': 'error', - 'message': 'Caught Bad state: error during protectAsync0' - }, { - 'result': 'error', - 'message': 'Caught Bad state: error during protectAsync1: one arg' - }, { - 'result': 'error', - 'message': 'Caught Bad state: error during protectAsync2: arg1, arg2' - }, { - 'result': 'pass', - 'message': '' - }]); + }, [ + { + 'result': 'error', + 'message': 'Caught Bad state: error during protectAsync0' + }, + { + 'result': 'error', + 'message': 'Caught Bad state: error during protectAsync1: one arg' + }, + { + 'result': 'error', + 'message': 'Caught Bad state: error during protectAsync2: arg1, arg2' + }, + {'result': 'pass', 'message': ''} + ]); } diff --git a/test/returning_future_test.dart b/test/returning_future_test.dart index d522643483e85e533578dd7a0d6cc3849215510f..d59d8c1be89c410115ddf953245021a91c8d045b 100644 --- a/test/returning_future_test.dart +++ b/test/returning_future_test.dart @@ -52,23 +52,19 @@ void _test(message) { fail('failure'); }); }); - test('foo5', () { - }); - }, [{ - 'result': 'pass' - }, { - 'result': 'fail', - 'message': 'Callback called more times than expected (1).' - }, { - 'result': 'fail', - 'message': 'Expected: <false>\n Actual: <true>\n' - }, { - 'result': 'fail', - 'message': 'Callback called more times than expected (1).' - }, { - 'result': 'fail', - 'message': 'failure' - }, { - 'result': 'pass' - }]); + test('foo5', () {}); + }, [ + {'result': 'pass'}, + { + 'result': 'fail', + 'message': 'Callback called more times than expected (1).' + }, + {'result': 'fail', 'message': 'Expected: <false>\n Actual: <true>\n'}, + { + 'result': 'fail', + 'message': 'Callback called more times than expected (1).' + }, + {'result': 'fail', 'message': 'failure'}, + {'result': 'pass'} + ]); } diff --git a/test/returning_future_using_runasync_test.dart b/test/returning_future_using_runasync_test.dart index 2f501730b197424cd4db446e01130bb5e3b1359e..3ae13c4d11e2374fa0d808ff5ad221b222d7c764 100644 --- a/test/returning_future_using_runasync_test.dart +++ b/test/returning_future_using_runasync_test.dart @@ -63,29 +63,25 @@ void _test(message) { }); }); }); - test('foo6', () { - }); - }, [{ - 'description': 'successful', - 'result': 'pass', - }, { - 'description': 'fail1', - 'message': 'Expected: <false>\n' ' Actual: <true>\n' '', - 'result': 'fail', - }, { - 'description': 'error1', - 'message': 'Callback called more times than expected (1).', - 'result': 'fail', - }, { - 'description': 'fail2', - 'message': 'failure', - 'result': 'fail', - }, { - 'description': 'error2', - 'message': 'Callback called more times than expected (1).', - 'result': 'fail', - }, { - 'description': 'foo6', - 'result': 'pass', - }]); + test('foo6', () {}); + }, [ + {'description': 'successful', 'result': 'pass',}, + { + 'description': 'fail1', + 'message': 'Expected: <false>\n' ' Actual: <true>\n' '', + 'result': 'fail', + }, + { + 'description': 'error1', + 'message': 'Callback called more times than expected (1).', + 'result': 'fail', + }, + {'description': 'fail2', 'message': 'failure', 'result': 'fail',}, + { + 'description': 'error2', + 'message': 'Callback called more times than expected (1).', + 'result': 'fail', + }, + {'description': 'foo6', 'result': 'pass',} + ]); } diff --git a/test/skipped_soloed_nested_test.dart b/test/skipped_soloed_nested_test.dart index 35d7d24e17ce677176dc8db9481b6f8d8baff288..1e590e7cb5dfdf6c9e952f85fe1af548b735fd75 100644 --- a/test/skipped_soloed_nested_test.dart +++ b/test/skipped_soloed_nested_test.dart @@ -65,25 +65,23 @@ void _test(message) { solo_test('final', () { expect(s.toString(), "EGHIHJHKHL"); }); - }, [{ - 'description': 'non-solo group solo_test in non-solo group', - 'result': 'pass', - }, { - 'description': 'solo group solo group non-solo test', - 'result': 'pass', - }, { - 'description': 'solo group solo group solo test', - 'result': 'pass', - }, { - 'description': 'solo group nested non-solo group in solo group ' - 'nested non-solo group non-solo test', - 'result': 'pass', - }, { - 'description': 'solo group nested non-solo group in solo group ' - 'nested non-solo group solo test', - 'result': 'pass', - }, { - 'description': 'final', - 'result': 'pass', - }]); + }, [ + { + 'description': 'non-solo group solo_test in non-solo group', + 'result': 'pass', + }, + {'description': 'solo group solo group non-solo test', 'result': 'pass',}, + {'description': 'solo group solo group solo test', 'result': 'pass',}, + { + 'description': 'solo group nested non-solo group in solo group ' + 'nested non-solo group non-solo test', + 'result': 'pass', + }, + { + 'description': 'solo group nested non-solo group in solo group ' + 'nested non-solo group solo test', + 'result': 'pass', + }, + {'description': 'final', 'result': 'pass',} + ]); } diff --git a/test/with_test_environment_test.dart b/test/with_test_environment_test.dart index 8d28993e47e5fd09d28eb5e795d052a9357a81fd..456384fa6f55ec9d4144b0e963a2025209c63013 100644 --- a/test/with_test_environment_test.dart +++ b/test/with_test_environment_test.dart @@ -14,7 +14,7 @@ class TestConfiguration extends SimpleConfiguration { TestConfiguration(); void onSummary(int passed, int failed, int errors, List<TestCase> results, - String uncaughtError) { + String uncaughtError) { super.onSummary(passed, failed, errors, results, uncaughtError); _results = results; }