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

Side by Side Diff: tests/compiler/dart2js_extra/consistent_subtract_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 '-' and slow path '-' produce the same error. 7 // Test that optimized '-' and slow path '-' produce the same error.
8 8
9 @NoInline() 9 @NoInline()
10 @AssumeDynamic() 10 @AssumeDynamic()
11 confuse(x) => x; 11 confuse(x) => x;
12 12
13 void check2(String name, name1, f1, name2, f2) { 13 void check2(String name, name1, f1, name2, f2) {
14 Error trap(part, f) { 14 Error trap(part, f) {
15 try { 15 try {
16 f(); 16 f();
17 } catch (e) { 17 } catch (e) {
18 return e; 18 return e;
19 } 19 }
20 Expect.fail('should throw: $name.$part'); 20 Expect.fail('should throw: $name.$part');
21 } 21 }
22
22 var e1 = trap(name1, f1); 23 var e1 = trap(name1, f1);
23 var e2 = trap(name2, f2); 24 var e2 = trap(name2, f2);
24 var s1 = '$e1'; 25 var s1 = '$e1';
25 var s2 = '$e2'; 26 var s2 = '$e2';
26 Expect.equals(s1, s2, '\n $name.$name1: "$s1"\n $name.$name2: "$s2"\n'); 27 Expect.equals(s1, s2, '\n $name.$name1: "$s1"\n $name.$name2: "$s2"\n');
27 } 28 }
28 29
29 void check(String name, f1, f2, [f3, f4, f5, f6, f7]) { 30 void check(String name, f1, f2, [f3, f4, f5, f6, f7]) {
30 check2(name, 'f1', f1, 'f2', f2); 31 check2(name, 'f1', f1, 'f2', f2);
31 if (f3 != null) check2(name, 'f1', f1, 'f3', f3); 32 if (f3 != null) check2(name, 'f1', f1, 'f3', f3);
(...skipping 14 matching lines...) Expand all
46 47
47 static f3() { 48 static f3() {
48 return (confuse(1) as int) - confuse(null); 49 return (confuse(1) as int) - confuse(null);
49 } 50 }
50 51
51 static f4() { 52 static f4() {
52 return (confuse(1) as int) - null; 53 return (confuse(1) as int) - null;
53 } 54 }
54 55
55 static f5() { 56 static f5() {
56 var a = confuse(true) ? 1 : 2; // Small int with unknown value. 57 var a = confuse(true) ? 1 : 2; // Small int with unknown value.
57 return a - confuse(null); 58 return a - confuse(null);
58 } 59 }
59 60
60 static f6() { 61 static f6() {
61 var a = confuse(true) ? 1 : 2; // Small int with unknown value. 62 var a = confuse(true) ? 1 : 2; // Small int with unknown value.
62 return a - null; 63 return a - null;
63 } 64 }
64 65
65 static f7() { 66 static f7() {
66 return 1 - null; 67 return 1 - null;
67 } 68 }
68 69
69 static test() { 70 static test() {
70 check('IntMinusNull', f1, f2, f3, f4, f5, f6, f7); 71 check('IntMinusNull', f1, f2, f3, f4, f5, f6, f7);
71 } 72 }
72 } 73 }
73 74
74 class IntMinusString { 75 class IntMinusString {
75 static f1() { 76 static f1() {
76 return confuse(1) - confuse('a'); 77 return confuse(1) - confuse('a');
77 } 78 }
78 79
79 static f2() { 80 static f2() {
80 return confuse(1) - 'a'; 81 return confuse(1) - 'a';
81 } 82 }
82 83
83 static f3() { 84 static f3() {
84 var a = confuse(true) ? 1 : 2; // Small int with unknown value. 85 var a = confuse(true) ? 1 : 2; // Small int with unknown value.
85 return a - confuse('a'); 86 return a - confuse('a');
86 } 87 }
87 88
88 static f4() { 89 static f4() {
89 return (confuse(1) as int) - confuse('a'); 90 return (confuse(1) as int) - confuse('a');
90 } 91 }
91 92
92 static f5() { 93 static f5() {
93 return (confuse(1) as int) - 'a'; 94 return (confuse(1) as int) - 'a';
94 } 95 }
95 96
96 static f6() { 97 static f6() {
97 var a = confuse(true) ? 1 : 2; // Small int with unknown value. 98 var a = confuse(true) ? 1 : 2; // Small int with unknown value.
98 return a - 'a'; 99 return a - 'a';
99 } 100 }
100 101
101 static f7() { 102 static f7() {
102 return 1 - 'a'; 103 return 1 - 'a';
103 } 104 }
104 105
105 static test() { 106 static test() {
106 check('IntMinusString', f1, f2, f3, f4, f5, f6, f7); 107 check('IntMinusString', f1, f2, f3, f4, f5, f6, f7);
107 } 108 }
108 } 109 }
109 110
110 main() { 111 main() {
111 IntMinusNull.test(); 112 IntMinusNull.test();
112 IntMinusString.test(); 113 IntMinusString.test();
113 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698