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

Unified Diff: tests/lib/typed_data/typed_data_list_test.dart

Issue 1180713003: Better messages for optimized index errors. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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 | « tests/compiler/dart2js_extra/consistent_index_error_typed_list_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/typed_data/typed_data_list_test.dart
diff --git a/tests/lib/typed_data/typed_data_list_test.dart b/tests/lib/typed_data/typed_data_list_test.dart
index 728416c8f3002ea18a33179b7cb9ebd6e6cb3803..f4f5ad4375f1da3fef47f264072b00269986621d 100644
--- a/tests/lib/typed_data/typed_data_list_test.dart
+++ b/tests/lib/typed_data/typed_data_list_test.dart
@@ -5,6 +5,10 @@
import 'dart:typed_data';
import 'package:expect/expect.dart';
+@AssumeDynamic()
+@NoInline()
+confuse(x) => x;
+
void testListFunctions(list, first, last, toElementType) {
assert(list.length > 0);
@@ -106,6 +110,17 @@ void testListFunctions(list, first, last, toElementType) {
list.sublist(1, list.length - 1));
Expect.listEquals(list.getRange(1, list.length).toList(), list.sublist(1));
Expect.listEquals(list, list.sublist(0));
+
+ Expect.listEquals([], list.sublist(0, 0));
+ Expect.listEquals([], list.sublist(list.length));
+ Expect.listEquals([], list.sublist(list.length, list.length));
+
+ Expect.throws(() => list.sublist(list.length + 1),
+ (e) => e is RangeError);
+ Expect.throws(() => list.sublist(0, list.length + 1),
+ (e) => e is RangeError);
+ Expect.throws(() => list.sublist(1, 0),
+ (e) => e is RangeError);
}
void emptyChecks(list) {
« no previous file with comments | « tests/compiler/dart2js_extra/consistent_index_error_typed_list_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698