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

Issue 11867012: Create a unit test config for the pub tests that's prettier. (Closed)

Created:
7 years, 11 months ago by Bob Nystrom
Modified:
7 years, 11 months ago
Reviewers:
nweiz
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Create a unit test config for the pub tests that's prettier. In particular, it: - Shows test results incrementally. - Cleans up the stack traces. - Doesn't show the failures and their stack traces twice. Right now, it's opt in. You need to: - Add initConfig() to the top of a test suite. - Pass "--human" when you run the test. At some point, I can add the initConfig() calls to every test suite but I figured we could just add them manually for now. Committed: https://code.google.com/p/dart/source/detail?r=17313

Patch Set 1 #

Total comments: 22

Patch Set 2 : Respond to review. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+149 lines, -1 line) Patch
A utils/tests/pub/command_line_config.dart View 1 1 chunk +139 lines, -0 lines 0 comments Download
M utils/tests/pub/test_pub.dart View 1 2 chunks +10 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
Bob Nystrom
7 years, 11 months ago (2013-01-18 01:57:04 UTC) #1
nweiz
Some suggestions, but otherwise LGTM. https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_config.dart File utils/tests/pub/command_line_config.dart (right): https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_config.dart#newcode23 utils/tests/pub/command_line_config.dart:23: String _padLeft(String string, int ...
7 years, 11 months ago (2013-01-18 03:35:06 UTC) #2
Bob Nystrom
7 years, 11 months ago (2013-01-18 21:11:32 UTC) #3
Thanks!

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
File utils/tests/pub/command_line_config.dart (right):

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:23: String _padLeft(String string, int
length) {
On 2013/01/18 03:35:06, nweiz wrote:
> Style nit: this probably belongs down near _indent.

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:38: case PASS: result =
'${_GREEN}\u2713${_NONE}'; break;
On 2013/01/18 03:35:06, nweiz wrote:
> It would be nice to have constants for the pass and fail characters as well.

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:48: if (testCase.stackTrace != null &&
testCase.stackTrace != '') {
On 2013/01/18 03:35:06, nweiz wrote:
> It would be nice to short-circuit here rather than indenting such a big block
of
> code.

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:50: var regex = new
RegExp(r'\#\d+\s+(.*) \(file:///([^)]+)\)');
On 2013/01/18 03:35:06, nweiz wrote:
> I don't think "#" needs to be escaped.
> 
> Also, "regexp" would be more consistent.

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:56: if (match == null) throw "Couldn't
clean up stack trace line '$line'.";
On 2013/01/18 03:35:06, nweiz wrote:
> Throwing here seems like it would be really annoying if the regexp ever
actually
> fails.

It's mostly just to get our attention to tweak the RegExp if it fails to match
some random unanticipated entry. Maybe I should assert instead?

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:57: stack.add([match[2], match[1]]);
On 2013/01/18 03:35:06, nweiz wrote:
> We do have a Pair class...

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:61: if (stack.length > 0) {
On 2013/01/18 03:35:06, nweiz wrote:
> Another place it might be nice to short-circuit.

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:66: var c = stack[0][0][common];
On 2013/01/18 03:35:06, nweiz wrote:
> I like ".first" better than "[0]". Also below.

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:76: }
On 2013/01/18 03:35:06, nweiz wrote:
> I'd probably factor this out into a "commonPrefix" function.

Pulled all of the stack clean up into a separate method.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:89: }
On 2013/01/18 03:35:06, nweiz wrote:
> "stack.map((pair) => pair.first.length).max()" would be cleaner.

Done.

https://codereview.chromium.org/11867012/diff/1/utils/tests/pub/command_line_...
utils/tests/pub/command_line_config.dart:126: // TODO(nweiz): Use this simpler
code once issue 2980 is fixed.
On 2013/01/18 03:35:06, nweiz wrote:
> That bug has been open for a long time.

<shrug>

Powered by Google App Engine
This is Rietveld 408576698