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

Unified Diff: tests/corelib/list_test.dart

Issue 50733002: Update List constructor documentation. Say that null is not a length. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests. Created 7 years, 2 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
« sdk/lib/core/list.dart ('K') | « sdk/lib/core/list.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 8883e491aa5a401a888487feb0b15627052c6a85..deb26547a50d483c6711554e3f4eed6c788d1a4a 100644
--- a/tests/corelib/list_test.dart
+++ b/tests/corelib/list_test.dart
@@ -44,6 +44,8 @@ void main() {
testTypedGrowableList(new Int16List(0).toList());
testTypedGrowableList(new Uint32List(0).toList());
testTypedGrowableList(new Int32List(0).toList());
+
+ testListConstructor();
}
void testLength(int length, List list) {
@@ -492,3 +494,13 @@ class MyFixedList<E> extends ListBase<E> {
E operator[](int index) => _source[index];
void operator[]=(int index, E value) { _source[index] = value; }
}
+
+void testListConstructor() {
+ Expect.throws(() { new List(0).add(4); }); // Is fixed-length.
+ Expect.throws(() { new List(-2); }); // Not negative.
+ Expect.throws(() { new List(null); }); // Not null.
+ Expect.listEquals([4], new List()..add(4));
+ Expect.throws(() { new List.filled(0, 42).add(4); }); // Is fixed-length.
+ Expect.throws(() { new List.filled(-2, 42); }); // Not negative.
+ Expect.throws(() { new List.filled(null, 42); }); // Not null.
+}
« sdk/lib/core/list.dart ('K') | « sdk/lib/core/list.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698