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

Issue 9320028: Wrote functions to convert collections and maps to strings and invoked (Closed)

Created:
8 years, 10 months ago by jjb
Modified:
8 years, 10 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Wrote functions to convert collections and maps to strings and invoked these functions from the toString methods of all built-in Collection and Map implementations. Wrote smoke tests and basher tests. BUG=4466785 Committed: https://code.google.com/p/dart/source/detail?r=4345

Patch Set 1 #

Total comments: 18

Patch Set 2 : #

Total comments: 4

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+481 lines, -26 lines) Patch
M corelib/src/implementation/hash_map_set.dart View 1 2 3 chunks +9 lines, -1 line 0 comments Download
M corelib/src/implementation/linked_hash_map.dart View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M corelib/src/implementation/maps.dart View 1 2 2 chunks +52 lines, -1 line 0 comments Download
M corelib/src/implementation/queue.dart View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M corelib/src/implementation/splay_tree.dart View 1 2 2 chunks +5 lines, -1 line 0 comments Download
M runtime/lib/array.dart View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M runtime/lib/arrays.dart View 1 2 1 chunk +1 line, -13 lines 0 comments Download
M runtime/lib/byte_array.dart View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/lib/collections.dart View 1 2 2 chunks +99 lines, -1 line 0 comments Download
M runtime/lib/growable_array.dart View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/lib/immutable_map.dart View 1 2 1 chunk +1 line, -2 lines 0 comments Download
A tests/corelib/src/CollectionToStringTest.dart View 1 2 1 chunk +295 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
jjb
Tests not written yet. Also I am not 100% sure that I hit all implementations ...
8 years, 10 months ago (2012-02-02 17:30:06 UTC) #1
sra1
On 2012/02/02 17:30:06, jjb wrote: > Tests not written yet. Also I am not 100% ...
8 years, 10 months ago (2012-02-02 19:45:48 UTC) #2
sra1
DBC http://codereview.chromium.org/9320028/diff/1/corelib/src/implementation/hash_map_set.dart File corelib/src/implementation/hash_map_set.dart (right): http://codereview.chromium.org/9320028/diff/1/corelib/src/implementation/hash_map_set.dart#newcode272 corelib/src/implementation/hash_map_set.dart:272: String toString() { String toString() => Maps.mapToString(this); Use ...
8 years, 10 months ago (2012-02-02 19:46:01 UTC) #3
jjb
On 2012/02/02 19:45:48, sra1 wrote: > On 2012/02/02 17:30:06, jjb wrote: > > Tests not ...
8 years, 10 months ago (2012-02-02 20:04:55 UTC) #4
sra1
On 2012/02/02 20:04:55, jjb wrote: > On 2012/02/02 19:45:48, sra1 wrote: > > On 2012/02/02 ...
8 years, 10 months ago (2012-02-02 20:09:58 UTC) #5
jjb
Thanks for taking a look at this! By the way, I believe that our style ...
8 years, 10 months ago (2012-02-02 20:30:33 UTC) #6
sra1
On 2012/02/02 20:30:33, jjb wrote: > Thanks for taking a look at this! > > ...
8 years, 10 months ago (2012-02-02 20:57:30 UTC) #7
sra1
http://codereview.chromium.org/9320028/diff/1/runtime/lib/collections.dart File runtime/lib/collections.dart (right): http://codereview.chromium.org/9320028/diff/1/runtime/lib/collections.dart#newcode73 runtime/lib/collections.dart:73: * simply return the results of this method applied ...
8 years, 10 months ago (2012-02-02 20:57:58 UTC) #8
Ivan Posva
https://chromiumcodereview.appspot.com/9320028/diff/1/runtime/lib/collections.dart File runtime/lib/collections.dart (right): https://chromiumcodereview.appspot.com/9320028/diff/1/runtime/lib/collections.dart#newcode94 runtime/lib/collections.dart:94: result.add(isList ? "[" : "{"); The one confusing part ...
8 years, 10 months ago (2012-02-02 23:39:35 UTC) #9
sra1
https://chromiumcodereview.appspot.com/9320028/diff/1/runtime/lib/collections.dart File runtime/lib/collections.dart (right): https://chromiumcodereview.appspot.com/9320028/diff/1/runtime/lib/collections.dart#newcode94 runtime/lib/collections.dart:94: result.add(isList ? "[" : "{"); On 2012/02/02 23:39:35, Ivan ...
8 years, 10 months ago (2012-02-04 08:42:50 UTC) #10
Bob Nystrom
Drive-by comments... https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementation/maps.dart File corelib/src/implementation/maps.dart (right): https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementation/maps.dart#newcode97 corelib/src/implementation/maps.dart:97: result.add("{"); Either way is OK, but we ...
8 years, 10 months ago (2012-02-06 18:23:17 UTC) #11
jjb
Thanks for the review. https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementation/maps.dart File corelib/src/implementation/maps.dart (right): https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementation/maps.dart#newcode97 corelib/src/implementation/maps.dart:97: result.add("{"); On 2012/02/06 18:23:17, Bob ...
8 years, 10 months ago (2012-02-06 19:10:03 UTC) #12
Bob Nystrom
https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementation/maps.dart File corelib/src/implementation/maps.dart (right): https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementation/maps.dart#newcode97 corelib/src/implementation/maps.dart:97: result.add("{"); On 2012/02/06 19:10:03, jjb wrote: > On 2012/02/06 ...
8 years, 10 months ago (2012-02-06 20:37:12 UTC) #13
jjb
PTAL I have written a reasonably thorough test. It does not yet cover a few ...
8 years, 10 months ago (2012-02-15 02:45:39 UTC) #14
sra1
https://chromiumcodereview.appspot.com/9320028/diff/10001/tests/corelib/src/CollectionToStringTest.dart File tests/corelib/src/CollectionToStringTest.dart (right): https://chromiumcodereview.appspot.com/9320028/diff/10001/tests/corelib/src/CollectionToStringTest.dart#newcode15 tests/corelib/src/CollectionToStringTest.dart:15: exactTest(); The tests are large and require careful reading. ...
8 years, 10 months ago (2012-02-15 03:11:10 UTC) #15
jjb
On 2012/02/15 03:11:10, sra1 wrote: > https://chromiumcodereview.appspot.com/9320028/diff/10001/tests/corelib/src/CollectionToStringTest.dart > File tests/corelib/src/CollectionToStringTest.dart (right): > > https://chromiumcodereview.appspot.com/9320028/diff/10001/tests/corelib/src/CollectionToStringTest.dart#newcode15 > ...
8 years, 10 months ago (2012-02-15 04:21:54 UTC) #16
Ivan Posva
8 years, 10 months ago (2012-02-15 09:54:10 UTC) #17
LGTM with the added smoke tests.

-Ivan

https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementat...
File corelib/src/implementation/maps.dart (right):

https://chromiumcodereview.appspot.com/9320028/diff/1/corelib/src/implementat...
corelib/src/implementation/maps.dart:97: result.add("{");
On 2012/02/06 18:23:17, Bob Nystrom wrote:
> Either way is OK, but we generally default to single-quoted stings unless the
> string happens to contain an apostrophe.

I think the choice is really personal preference. As noted below there are
stumbling blocks with both defaults. The resolution of a project wide preference
should not block this change.

https://chromiumcodereview.appspot.com/9320028/diff/1/runtime/lib/collections...
File runtime/lib/collections.dart (right):

https://chromiumcodereview.appspot.com/9320028/diff/1/runtime/lib/collections...
runtime/lib/collections.dart:77: _emitCollection(c, result, new List());
On 2012/02/02 19:46:01, sra1 wrote:
> '[]' is more Dart-idiomatic than 'new List()'

Again that really depends on your personal preference. I am fine either way and
for the use here I do actually prefer the "new List()" even if some other people
would have their fingers fall off because of too much typing.

https://chromiumcodereview.appspot.com/9320028/diff/10001/runtime/lib/collect...
File runtime/lib/collections.dart (right):

https://chromiumcodereview.appspot.com/9320028/diff/10001/runtime/lib/collect...
runtime/lib/collections.dart:53: // todo(jjb): visiting list should be an
identityHashSet when it exists
All caps TODO.

https://chromiumcodereview.appspot.com/9320028/diff/10001/tests/corelib/src/C...
File tests/corelib/src/CollectionToStringTest.dart (right):

https://chromiumcodereview.appspot.com/9320028/diff/10001/tests/corelib/src/C...
tests/corelib/src/CollectionToStringTest.dart:9: // todo(jjb): seed random
number generator when API allows it
Allcaps TODO. Here and maybe other places.

https://chromiumcodereview.appspot.com/9320028/diff/10001/tests/corelib/src/C...
tests/corelib/src/CollectionToStringTest.dart:15: exactTest();
On 2012/02/15 03:11:10, sra1 wrote:
> The tests are large and require careful reading.
> It would be nice to see a few simpler tests that give confidence that the
> algorithmic tests are testing what we expect, e.g
> 
> Expect.equals('[]', [].toString);
> 
> Expect.equals('[1,two]', [1, 'two'].toString());
> Expect.equals('[1,two]', <String>['1', 'two'].toString());

Adding a couple of these before starting the more involved tests would really
help with smoke testing this. It has the additional benefit of checking the
literals, so you should also include a couple of "const [1, 2]" style literals.

Powered by Google App Engine
This is Rietveld 408576698