Commit graph

12 commits

Author SHA1 Message Date
Martin Kustermann 26aa50fdbf [dart2wasm] Fix off-by-one error in List.insert()
Closes https://github.com/dart-lang/sdk/issues/54845

TEST=lib/collection/regress_54845_test

Change-Id: I1af7f59a57c70ef5ec724b089555ebbcbd88a484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351120
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-02-08 14:05:44 +00:00
Jake Macdonald af6e1bf5a4 [flip-modifiers]: prep more tests for the class modifiers flag flip
TEST=only test changes

Change-Id: I725bd897e9e749ab6010c99ee74c20ee64e61500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286981
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-03-06 20:52:03 +00:00
Stephen Adams 8d335e5e08 [lib/collection] Test for #48282
Change-Id: I62306feab09f8dcd0335daa296b6c744bc139e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231336
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-08 19:36:38 +00:00
Lasse R.H. Nielsen ed3824a220 Tweaks, refactoring and updates on DoubleLinkedQueue.
It's a badly designed class, but this change makes it slightly better.
(We should consider moving it to package:collection and removing it from
the platform libraries. Eventually.)

The changes decouples the public `DoubleLinkedQueueEntry` class from
the actual queue implementation classes, avoiding the latter having
to share a generic `_Link<DoubleLinkedQueueEntry>` interface
which would force them to do otherwise unnecessary casts.

The public class should have been abstract, but isn't.
It's mainly used as the API of the entries exposed by DoubleLinkedQueue,
but it can also be used by itself to build double-linked lists that are
not part of a Queue, and the class can be extended.
If anyone does either, it should keep working, so it needs to be a concrete,
self-contained class with a generative constructor.

That class is moved to dart:_internal to avoid its private
implementation fields from interfering with the queue implementation classes,
which have similar fields, but can now have them at different types.
That's a hack, but it works.

The internal implementation of the DoubleLinkedQueue and its entries
are updated to better follow current programming idioms, and avoids
having fields on classes which don't need them.

Also fixes #27920
(`clear`ing a list now detaches each entry from the list so later `.contains`
won't give the wrong answer).

And moves queue tests from tests/corelib to tests/lib/collection,
since Queue isn't exposed by `dart:core`.

BUG= https://github.com/dart-lang/sdk/issues/27920

Change-Id: Ia3bb340a75886de160cc0e449947e8e7ee587061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211265
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-08-31 12:44:39 +00:00
Lasse Reichstein Holst Nielsen 8129c40c5e Update LinkedList.contains to take advantage of internal structure.
Made it explicit in the documentation that elements of the `LinkedList`
are compared using identity, not `operator==`, even if they choose to
override that.
The linked list entries are directly linked to their containing list,
which is what defined their containing list. Merely being equal to an entry
of a list does not make another entry belong to that list.

The `contains` method now simply checks that the `list` property of the
the provided entry is the list itself, which matches the existing behavior
of `remove`.

Fixes #44189.

Bug: https://github.com/dart-lang/sdk/issues/44189
Change-Id: Ia6a7fd461ddf18f99121662f87e83415746e1ca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172161
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-02 14:08:08 +00:00
Markzipan 7397c03670 [tests] Cleaning up strong mode tests.
Change-Id: I78ee36b245fb91f23775de87ce616445fbcbdb7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139039
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-16 16:54:56 +00:00
Robert Nystrom ccaea0ef80 Migrate lib_2/collection tests to NNBD.
Change-Id: Ia76fb4b8354127638af281ad735c3e4aee99ef0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128309
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2019-12-17 20:25:14 +00:00
Bob Nystrom f6ca2c1d8f Remove the Dart 1 tests.
This deletes:

tests/co19
tests/corelib
tests/html
tests/isolate
tests/language
tests/lib

It does not delete tests/standalone because apparently there are tests
in there that are not in standalone_2. (I assume they were added after
the test migration. I don't know why they were added there.)

I have tried to remove references to the old tests from various scripts
and tools but may have missed some. (As you can imagine, grepping for
"lib" does not have the best signal-to-noise ratio.)

"It was a pleasure to burn. It was a special pleasure to see things
eaten, to see things blackened and changed. With the brass nozzle in his
fists, with this great python spitting its venomous kerosene upon the
world, the blood pounded in his head, and his hands were the hands of
some amazing conductor playing all the symphonies of blazing and burning
to bring down the tatters and charcoal ruins of history."

- Ray Bradbury, Fahrenheit 451

Change-Id: If3db4a50e7a5ee25aff8058b1483e2ce8e68424e
Reviewed-on: https://dart-review.googlesource.com/c/75420
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Terry Lucas <terry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-11 23:45:18 +00:00
Jacob Richman 2dcd56ef43 Format all tests.
There are far too many files here to review everyone carefully.
Spot checking most of the diffs look good as test code is generally written
with less care than application code so lots of ugly formatting get through.
If people notice files where the automated formatting bothers them feel free
to comment indicating file names and I'll move spaces within comments to make
the formatting cleaner and use comments to force block formatting as I have
done for other case where formatting looked bad.

BUG=
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2771453003 .
2017-04-17 14:53:02 -07:00
Florian Loitsch e1bf3506d1 Make linked-list non-circular.
This bug was introduced when making the collection library strong-mode clean.

Fixes #26522
BUG= http://dartbug.com/26522
R=lrn@google.com

Review URL: https://codereview.chromium.org/2015513006 .
2016-06-01 14:19:37 +02:00
lrn@google.com dcbccb5d5d Fix dart2js custom hashmap/set not using the custom method for string.
BUG= http://dartbug.com/18109
R=floitsch@google.com

Review URL: https://codereview.chromium.org//230443002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34870 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-09 11:02:09 +00:00
ajohnsen@google.com feca0ac6dd Introduce new LinkedList to dart:collection.
LinkedList required the element to extend LinkedListEntry. This is
useful for implementation that want to remove/unlink a entry in O(1), given the
entry.

BUG=
R=floitsch@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//13459002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23969 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-13 11:54:06 +00:00