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

Issue 10832058: Improved the way we generate mismatch descriptions. (Closed)

Created:
8 years, 4 months ago by gram
Modified:
8 years, 4 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Improved the way we generate mismatch descriptions. matches() methods can now return additional state that is used by describeMismatch(). This adds a small tax to the happy path, but makes the unhappy path quite a bit more efficient as well as providing better error messages. Related to this, expect() can now be passed a verbose flag. Currently this is used by throwsA/returnsNormally to provide stack traces from the actual exception but could be used for other things too. The tests for the Mock classes have been changed to be normal tests, not 'meta' tests. A couple of other minor fixes. Committed: https://code.google.com/p/dart/source/detail?r=10078

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 15

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+313 lines, -774 lines) Patch
M lib/unittest/collection_matchers.dart View 1 2 3 5 chunks +44 lines, -11 lines 0 comments Download
M lib/unittest/core_matchers.dart View 1 2 3 24 chunks +72 lines, -41 lines 0 comments Download
M lib/unittest/expect.dart View 1 2 3 4 5 chunks +19 lines, -8 lines 0 comments Download
M lib/unittest/future_matchers.dart View 1 2 3 2 chunks +2 lines, -2 lines 0 comments Download
M lib/unittest/interfaces.dart View 1 2 3 3 chunks +28 lines, -9 lines 0 comments Download
M lib/unittest/map_matchers.dart View 1 2 3 2 chunks +8 lines, -5 lines 0 comments Download
M lib/unittest/matcher.dart View 1 2 3 2 chunks +24 lines, -4 lines 0 comments Download
M lib/unittest/mock.dart View 1 2 3 16 chunks +54 lines, -32 lines 0 comments Download
M lib/unittest/numeric_matchers.dart View 1 2 3 5 chunks +10 lines, -7 lines 0 comments Download
M lib/unittest/operator_matchers.dart View 1 2 3 3 chunks +16 lines, -13 lines 0 comments Download
M lib/unittest/string_matchers.dart View 1 2 3 7 chunks +18 lines, -10 lines 0 comments Download
M tests/lib/unittest/instance_test.dart View 1 2 3 2 chunks +1 line, -2 lines 0 comments Download
M tests/lib/unittest/matchers_test.dart View 1 2 3 11 chunks +12 lines, -12 lines 0 comments Download
M tests/lib/unittest/unittest_test.dart View 1 2 3 4 5 4 chunks +2 lines, -616 lines 0 comments Download
M utils/tests/pub/version_test.dart View 1 2 3 1 chunk +3 lines, -2 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
gram
8 years, 4 months ago (2012-07-29 16:14:32 UTC) #1
Siggi Cherem (dart-lang)
No need to split them now, but for the future reference I'd prefer to have ...
8 years, 4 months ago (2012-07-31 17:16:40 UTC) #2
gram
PTAL http://codereview.chromium.org/10832058/diff/4001/lib/unittest/collection_matchers.dart File lib/unittest/collection_matchers.dart (right): http://codereview.chromium.org/10832058/diff/4001/lib/unittest/collection_matchers.dart#newcode26 lib/unittest/collection_matchers.dart:26: 'state': matchState.state On 2012/07/31 17:16:40, sigmund wrote: > ...
8 years, 4 months ago (2012-07-31 17:56:01 UTC) #3
Siggi Cherem (dart-lang)
8 years, 4 months ago (2012-07-31 17:59:43 UTC) #4
Thanks! lgtm!

http://codereview.chromium.org/10832058/diff/4001/lib/unittest/core_matchers....
File lib/unittest/core_matchers.dart (right):

http://codereview.chromium.org/10832058/diff/4001/lib/unittest/core_matchers....
lib/unittest/core_matchers.dart:235: *     or twice upon failure (the second
time to get the failure description).
On 2012/07/31 17:56:01, gram wrote:
> On 2012/07/31 17:16:40, sigmund wrote:
> > Regarding this part - is it still true that we call the function twice? with
> > MatcherState you no longer need to do this, right?
> 
> Actually the double call was removed some time back, but in the process we
lost
> the details of whether the failure was due to not throwing or due to a
> mismatched throw. We can now bring that detail (and more) back.
> 

Cool, let's fix the comment then :)

Powered by Google App Engine
This is Rietveld 408576698