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

Side by Side Diff: tests/language/src/ListTest.dart

Issue 9007015: Fix issue 920: do not allow length of a list go below 0. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program for testing arrays. 4 // Dart test program for testing arrays.
5 5
6 class ListTest { 6 class ListTest {
7 static void TestIterator() { 7 static void TestIterator() {
8 List<int> a = new List<int>(10); 8 List<int> a = new List<int>(10);
9 int count = 0; 9 int count = 0;
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 Expect.equals(true, exceptionCaught); 131 Expect.equals(true, exceptionCaught);
132 132
133 exceptionCaught = false; 133 exceptionCaught = false;
134 try { 134 try {
135 var a = new List(99999999999999999999999); // Non-Smi. 135 var a = new List(99999999999999999999999); // Non-Smi.
136 } catch (Exception e) { // Must agree which exception to throw. 136 } catch (Exception e) { // Must agree which exception to throw.
137 exceptionCaught = true; 137 exceptionCaught = true;
138 } 138 }
139 Expect.equals(true, exceptionCaught); 139 Expect.equals(true, exceptionCaught);
140
141 exceptionCaught = false;
142 List list = new List();
143 try {
144 list.removeLast();
145 } catch (IndexOutOfRangeException e) {
146 exceptionCaught = true;
147 }
148 Expect.equals(0, list.length);
149 Expect.equals(true, exceptionCaught);
140 } 150 }
141 } 151 }
142 152
143 main() { 153 main() {
144 ListTest.testMain(); 154 ListTest.testMain();
145 } 155 }
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698