考虑以下代码:
group('Tweets: ', () {
test('Create tweets', () {
var tweets = new Tweets();
expect(tweets, isNull); // intentionally wrong!
});
test('Add', () {
var tweets = new Tweets();
expect(tweets, isNotNull);
});
});
给出以下 ok 结果:
dart --enable-checked-mode TwitterSearchTest.dart
unittest-suite-wait-for-done
FAIL: Tweets: Create tweets
Expected: null
but: was <Instance of 'Tweets'>.
#0 DefaultFailureHandler.fail (package:unittest/src/expect.dart:86:5)
#1 DefaultFailureHandler.failMatch (package:unittest/src/expect.dart:90:9)
#2 expect (package:unittest/src/expect.dart:55:29)
#3 main.<anonymous closure>.<anonymous closure> (file:///C:/Users/John/tmp/Dart/TwitterSearchTest/TwitterSearchTest.dart:8:13)
#4 TestCase.run (package:unittest/src/test_case.dart:83:11)
#5 _nextBatch._nextBatch.<anonymous closure> (package:unittest/unittest.dart:807:19)
#6 guardAsync (package:unittest/unittest.dart:766:19)
PASS: Tweets: Add
1 PASSED, 1 FAILED, 0 ERRORS
Unhandled exception:
Exception: Some tests failed.
#0 Configuration.onDone (package:unittest/src/config.dart:130:7)
#1 _completeTests (package:unittest/unittest.dart:835:17)
#2 _nextBatch._nextBatch (package:unittest/unittest.dart:818:17)
#3 runTests.runTests.<anonymous closure> (package:unittest/unittest.dart:755:16)
#4 _defer.<anonymous closure> (package:unittest/unittest.dart:712:13)
#5 _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)
我的问题:
- 如何摆脱结果中的调用堆栈?
- 我假设最后一个未处理的异常仍然是 unittester 中的错误?