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

Unified Diff: tests/corelib/iterable_to_list_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « tests/corelib/iterable_take_while_test.dart ('k') | tests/corelib/iterable_to_set_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/iterable_to_list_test.dart
diff --git a/tests/corelib/iterable_to_list_test.dart b/tests/corelib/iterable_to_list_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6cb3c5208d55f88e43651f7649af74edcc155a45
--- /dev/null
+++ b/tests/corelib/iterable_to_list_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+main() {
+ List<int> list1 = <int>[1, 2, 3];
+ List<int> list2 = const <int>[4, 5];
+ List<String> list3 = <String>[];
+ Set<int> set1 = new Set<int>();
+ set1..add(11)
+ ..add(12)
+ ..add(13);
+ Set<String> set2 = new Set<String>();
+ set2..add("foo")
+ ..add("bar")
+ ..add("toto");
+ Set set3 = new Set();
+
+ var listCopy = list1.toList();
+ Expect.listEquals(list1, listCopy);
+ Expect.isTrue(listCopy is List<int>);
+ Expect.isFalse(listCopy is List<String>);
+ Expect.isFalse(identical(list1, listCopy));
+
+ listCopy = list2.toList();
+ Expect.listEquals(list2, listCopy);
+ Expect.isTrue(listCopy is List<int>);
+ Expect.isFalse(listCopy is List<String>);
+ Expect.isFalse(identical(list2, listCopy));
+
+ listCopy = list3.toList();
+ Expect.listEquals(list3, listCopy);
+ Expect.isTrue(listCopy is List<String>);
+ Expect.isFalse(listCopy is List<int>);
+ Expect.isFalse(identical(list3, listCopy));
+
+ listCopy = set1.toList();
+ Expect.equals(3, listCopy.length);
+ Expect.isTrue(listCopy.contains(11));
+ Expect.isTrue(listCopy.contains(12));
+ Expect.isTrue(listCopy.contains(13));
+ Expect.isTrue(listCopy is List<int>);
+ Expect.isFalse(listCopy is List<String>);
+
+ listCopy = set2.toList();
+ Expect.equals(3, listCopy.length);
+ Expect.isTrue(listCopy.contains("foo"));
+ Expect.isTrue(listCopy.contains("bar"));
+ Expect.isTrue(listCopy.contains("toto"));
+ Expect.isTrue(listCopy is List<String>);
+ Expect.isFalse(listCopy is List<int>);
+
+ listCopy = set3.toList();
+ Expect.isTrue(listCopy.isEmpty);
+ Expect.isTrue(listCopy is List<int>);
+ Expect.isTrue(listCopy is List<String>);
+}
« no previous file with comments | « tests/corelib/iterable_take_while_test.dart ('k') | tests/corelib/iterable_to_set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698