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

Side by Side Diff: tests/compiler/dart2js_extra/js_array_removeLast_error_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // Test that optimized JSArray removeLast() calls generate the same error as 5 // Test that optimized JSArray removeLast() calls generate the same error as
6 // dyncamically dispatched calls. 6 // dyncamically dispatched calls.
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 @NoInline() @AssumeDynamic() 10 @NoInline()
11 @AssumeDynamic()
11 confuse(x) => x; 12 confuse(x) => x;
12 13
13
14 Error getError(action()) { 14 Error getError(action()) {
15 try { 15 try {
16 action(); 16 action();
17 Expect.fail('must throw'); 17 Expect.fail('must throw');
18 } catch (e) { 18 } catch (e) {
19 return e; 19 return e;
20 } 20 }
21 } 21 }
22 22
23 main() { 23 main() {
24 fault1() { 24 fault1() {
25 return confuse([]).removeLast(); 25 return confuse([]).removeLast();
26 } 26 }
27 27
28 fault2() { 28 fault2() {
29 var a = []; 29 var a = [];
30 while (confuse(false)) a.add(1); 30 while (confuse(false)) a.add(1);
31 // This one should be optimized since [a] is a growable JSArray. 31 // This one should be optimized since [a] is a growable JSArray.
32 return a.removeLast(); 32 return a.removeLast();
33 } 33 }
34 34
35 var e1 = getError(fault1); 35 var e1 = getError(fault1);
36 var e2 = getError(fault2); 36 var e2 = getError(fault2);
37 37
38 Expect.equals('$e1', '$e2'); 38 Expect.equals('$e1', '$e2');
39 } 39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698