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

Unified Diff: tests/language/optimized_constant_array_string_access_test.dart

Issue 14566020: - Correctly handle negative constant indices when (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/optimized_constant_array_string_access_test.dart
===================================================================
--- tests/language/optimized_constant_array_string_access_test.dart (revision 22702)
+++ tests/language/optimized_constant_array_string_access_test.dart (working copy)
@@ -19,15 +19,25 @@
int testConstantArrayAndIndexAt() {
- int test(b) {
+ int testPositive(b) {
var a = const [1,2,3,4];
if (b) return a[400];
return a[2];
}
- Expect.throws(() => test(true));
- for (int i = 0; i < 10000; i++) test(false);
- Expect.throws(() => test(true));
+ int testNegative(b) {
+ var a = const [1,2,3,4];
+ if (b) return a[-1];
+ return a[2];
+ }
+
+ Expect.throws(() => testPositive(true));
+ for (int i = 0; i < 10000; i++) testPositive(false);
+ Expect.throws(() => testPositive(true));
+
+ Expect.throws(() => testNegative(true));
+ for (int i = 0; i < 10000; i++) testNegative(false);
+ Expect.throws(() => testNegative(true));
}
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698