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

Issue 23480055: Formatter sanity-checking (via token stream verification). (Closed)

Created:
7 years, 3 months ago by pquitslund
Modified:
7 years, 3 months ago
Reviewers:
Brian Wilkerson
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Formatter sanity-checking (via token stream verification). R=brianwilkerson@google.com Committed: https://code.google.com/p/dart/source/detail?r=27343

Patch Set 1 #

Patch Set 2 : #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+249 lines, -61 lines) Patch
M pkg/analyzer_experimental/bin/formatter.dart View 3 chunks +5 lines, -5 lines 0 comments Download
M pkg/analyzer_experimental/lib/src/services/formatter_impl.dart View 12 chunks +154 lines, -38 lines 4 comments Download
M pkg/analyzer_experimental/lib/src/services/writer.dart View 2 chunks +2 lines, -2 lines 0 comments Download
M pkg/analyzer_experimental/test/services/formatter_test.dart View 9 chunks +88 lines, -16 lines 4 comments Download

Messages

Total messages: 4 (0 generated)
pquitslund
7 years, 3 months ago (2013-09-09 22:02:00 UTC) #1
Brian Wilkerson
LGTM https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart File pkg/analyzer_experimental/lib/src/services/formatter_impl.dart (right): https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/lib/src/services/formatter_impl.dart#newcode108 pkg/analyzer_experimental/lib/src/services/formatter_impl.dart:108: checkTokenStreams(start, tokenize(source)); It looks like you're testing to ...
7 years, 3 months ago (2013-09-09 22:21:47 UTC) #2
pquitslund
Committed patchset #2 manually as r27343 (presubmit successful).
7 years, 3 months ago (2013-09-10 17:11:02 UTC) #3
pquitslund
7 years, 3 months ago (2013-09-10 18:24:13 UTC) #4
Message was sent while issue was closed.
Thank you!

https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/...
File pkg/analyzer_experimental/lib/src/services/formatter_impl.dart (right):

https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/...
pkg/analyzer_experimental/lib/src/services/formatter_impl.dart:108:
checkTokenStreams(start, tokenize(source));
On 2013/09/09 22:21:47, Brian Wilkerson wrote:
> It looks like you're testing to see whether the scanner is deterministic
(start
> is the same as tokenize(source), so the left and right should always be the
> same). I think you want to tokenize the return value before returning it.

Hilarious.  Looks like I did one undo too many!  Thanks for the catch :)

https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/...
pkg/analyzer_experimental/lib/src/services/formatter_impl.dart:259: 
On 2013/09/09 22:21:47, Brian Wilkerson wrote:
> The parser uses a similar method, but passes the expected token type in as a
> parameter:
> 
>   matches(Token token, TokenType type)
> 
> (there's less duplication that way).

Done.

https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/...
File pkg/analyzer_experimental/test/services/formatter_test.dart (right):

https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/...
pkg/analyzer_experimental/test/services/formatter_test.dart:757:
expectTokenizedEqual('class A{}', 'class A{ }');
On 2013/09/09 22:21:47, Brian Wilkerson wrote:
> In all of the equal cases the strings are identical. It would be good to test
> with strings that have whitespace differences.

Added some.  Thanks!

https://codereview.chromium.org/23480055/diff/1005/pkg/analyzer_experimental/...
pkg/analyzer_experimental/test/services/formatter_test.dart:910: Token
string(String lexeme) => new StringToken(TokenType.STRING, lexeme, 0);
On 2013/09/09 22:21:47, Brian Wilkerson wrote:
> There is a TokenFactory class in the engine tests that might be useful.

I'll look.  Thanks!

Powered by Google App Engine
This is Rietveld 408576698