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

Unified Diff: tests/corelib/list_test.dart

Issue 10553034: Stop mapping indexOf/lastIndexOf directly to the JavaScript native on indexable primitives. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/list_test.dart
diff --git a/tests/corelib/list_test.dart b/tests/corelib/list_test.dart
index 795b94cd22bdb4a858aaca288ed39fbce49931da..a98f4a8eaf4f17a0c6d6f4056b2afa5be3215289 100644
--- a/tests/corelib/list_test.dart
+++ b/tests/corelib/list_test.dart
@@ -65,9 +65,26 @@ class ListTest {
}
for (int i = 0; i < 4; i++) {
- Expect.equals(list[i], i);
+ Expect.equals(i, list[i]);
+ Expect.equals(i, list.indexOf(i));
+ Expect.equals(i, list.lastIndexOf(i));
}
+ Expect.equals(-1, list.indexOf(100));
+ Expect.equals(-1, list.lastIndexOf(100));
+ list[2] = new Yes();
+ Expect.equals(2, list.indexOf(100));
+ Expect.equals(2, list.lastIndexOf(100));
+ list[3] = new Yes();
+ Expect.equals(2, list.indexOf(100));
+ Expect.equals(3, list.lastIndexOf(100));
+ list[2] = 2;
+ Expect.equals(3, list.indexOf(100));
+ Expect.equals(3, list.lastIndexOf(100));
+ list[3] = 3;
+ Expect.equals(-1, list.indexOf(100));
+ Expect.equals(-1, list.lastIndexOf(100));
+
testClosures(list);
var exception = null;
@@ -96,9 +113,26 @@ class ListTest {
Expect.equals(list.length, 10);
for (int i = 0; i < 10; i++) {
- Expect.equals(list[i], i);
+ Expect.equals(i, list[i]);
+ Expect.equals(i, list.indexOf(i));
+ Expect.equals(i, list.lastIndexOf(i));
}
+ Expect.equals(-1, list.indexOf(100));
+ Expect.equals(-1, list.lastIndexOf(100));
+ list[2] = new Yes();
+ Expect.equals(2, list.indexOf(100));
+ Expect.equals(2, list.lastIndexOf(100));
+ list[3] = new Yes();
+ Expect.equals(2, list.indexOf(100));
+ Expect.equals(3, list.lastIndexOf(100));
+ list[2] = 2;
+ Expect.equals(3, list.indexOf(100));
+ Expect.equals(3, list.lastIndexOf(100));
+ list[3] = 3;
+ Expect.equals(-1, list.indexOf(100));
+ Expect.equals(-1, list.lastIndexOf(100));
+
testClosures(list);
Expect.equals(list.removeLast(), 9);
@@ -109,6 +143,10 @@ class ListTest {
}
}
+class Yes {
+ operator ==(var other) => true;
+}
+
main() {
ListTest.testMain();
}
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698