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

Side by Side Diff: tests/compiler/dart2js_extra/consistent_null_add_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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Test that optimized 'null + x' and slow path '+' produce the same error. 7 // Test that optimized 'null + x' and slow path '+' produce the same error.
8 // 8 //
9 // They don't, sometimes we generate null.$add, sometimes JSNull_methods.$add. 9 // They don't, sometimes we generate null.$add, sometimes JSNull_methods.$add.
10 10
11
12 @NoInline() 11 @NoInline()
13 @AssumeDynamic() 12 @AssumeDynamic()
14 confuse(x) => x; 13 confuse(x) => x;
15 14
16 void check2(String name, name1, f1, name2, f2) { 15 void check2(String name, name1, f1, name2, f2) {
17 Error trap(part, f) { 16 Error trap(part, f) {
18 try { 17 try {
19 f(); 18 f();
20 } catch (e) { 19 } catch (e) {
21 return e; 20 return e;
22 } 21 }
23 Expect.fail('should throw: $name.$part'); 22 Expect.fail('should throw: $name.$part');
24 } 23 }
24
25 var e1 = trap(name1, f1); 25 var e1 = trap(name1, f1);
26 var e2 = trap(name2, f2); 26 var e2 = trap(name2, f2);
27 var s1 = '$e1'; 27 var s1 = '$e1';
28 var s2 = '$e2'; 28 var s2 = '$e2';
29 Expect.equals(s1, s2, '\n $name.$name1: "$s1"\n $name.$name2: "$s2"\n'); 29 Expect.equals(s1, s2, '\n $name.$name1: "$s1"\n $name.$name2: "$s2"\n');
30 } 30 }
31 31
32 void check(String name, f1, f2, [f3, f4, f5, f6]) { 32 void check(String name, f1, f2, [f3, f4, f5, f6]) {
33 check2(name, 'f1', f1, 'f2', f2); 33 check2(name, 'f1', f1, 'f2', f2);
34 if (f3 != null) check2(name, 'f1', f1, 'f3', f3); 34 if (f3 != null) check2(name, 'f1', f1, 'f3', f3);
35 if (f4 != null) check2(name, 'f1', f1, 'f4', f4); 35 if (f4 != null) check2(name, 'f1', f1, 'f4', f4);
36 if (f5 != null) check2(name, 'f1', f1, 'f5', f5); 36 if (f5 != null) check2(name, 'f1', f1, 'f5', f5);
37 if (f6 != null) check2(name, 'f1', f1, 'f6', f6); 37 if (f6 != null) check2(name, 'f1', f1, 'f6', f6);
38 } 38 }
39 39
40
41 class NullPlusInt { 40 class NullPlusInt {
42 static f1() { 41 static f1() {
43 return confuse(null) + confuse(1); 42 return confuse(null) + confuse(1);
44 } 43 }
45 44
46 static f2() { 45 static f2() {
47 return confuse(null) + 1; 46 return confuse(null) + 1;
48 } 47 }
49 48
50 static f3() { 49 static f3() {
(...skipping 22 matching lines...) Expand all
73 check('NullPlusInt', f3, f3); 72 check('NullPlusInt', f3, f3);
74 check('NullPlusInt', f4, f4); 73 check('NullPlusInt', f4, f4);
75 check('NullPlusInt', f5, f5); 74 check('NullPlusInt', f5, f5);
76 check('NullPlusInt', f6, f6); 75 check('NullPlusInt', f6, f6);
77 } 76 }
78 } 77 }
79 78
80 main() { 79 main() {
81 NullPlusInt.test(); 80 NullPlusInt.test();
82 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698