| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 5 // Test optimized [] on strings. | 7 // Test optimized [] on strings. |
| 6 | 8 |
| 7 var a = "abc"; | 9 var a = "abc"; |
| 8 var b = "øbc"; | 10 var b = "øbc"; |
| 9 var c = new String.fromCharCodes([123, 456, 789]); | 11 var c = new String.fromCharCodes([123, 456, 789]); |
| 10 | 12 |
| 11 test_charat(s, i) { | 13 test_charat(s, i) { |
| 12 return s[i]; | 14 return s[i]; |
| 13 } | 15 } |
| 14 | 16 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 58 |
| 57 Expect.equals(new String.fromCharCodes([123]), test_charat(c, 0)); | 59 Expect.equals(new String.fromCharCodes([123]), test_charat(c, 0)); |
| 58 for (var i=0; i<10000; i++) test_charat(c, 0); | 60 for (var i=0; i<10000; i++) test_charat(c, 0); |
| 59 Expect.equals(new String.fromCharCodes([123]), test_charat(c, 0)); | 61 Expect.equals(new String.fromCharCodes([123]), test_charat(c, 0)); |
| 60 Expect.equals(new String.fromCharCodes([456]), test_charat(c, 1)); | 62 Expect.equals(new String.fromCharCodes([456]), test_charat(c, 1)); |
| 61 Expect.equals(new String.fromCharCodes([789]), test_charat(c, 2)); | 63 Expect.equals(new String.fromCharCodes([789]), test_charat(c, 2)); |
| 62 Expect.throws(() => test_charat(c, 3)); | 64 Expect.throws(() => test_charat(c, 3)); |
| 63 | 65 |
| 64 | 66 |
| 65 } | 67 } |
| OLD | NEW |