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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: 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) 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"; 5 import "package:expect/expect.dart";
6 6
7 // Make sure we use JavaScript semantics when compiling compile-time constants. 7 // Make sure we use JavaScript semantics when compiling compile-time constants.
8 8
9 const x = 12345678901234567891; 9 const x = 12345678901234567891;
10 const y = 12345678901234567890; 10 const y = 12345678901234567890;
11 const z = x - y; 11 const z = x - y;
12 12
13 const a = 1.0; 13 const a = 1.0;
14 const b = a << 3; /// 01: compile-time error 14 const b = a << 3;
15
16 /// 01: compile-time error
15 17
16 const c = -0.0; 18 const c = -0.0;
17 const d = c << 1; /// 02: compile-time error 19 const d = c << 1;
20
21 /// 02: compile-time error
18 22
19 foo() => 12345678901234567891 - 12345678901234567890; 23 foo() => 12345678901234567891 - 12345678901234567890;
20 24
21 main() { 25 main() {
22 Expect.equals(0, z); 26 Expect.equals(0, z);
23 Expect.equals(0, x - y); 27 Expect.equals(0, x - y);
24 Expect.equals(0, foo()); 28 Expect.equals(0, foo());
25 Expect.isTrue(x is double); 29 Expect.isTrue(x is double);
26 Expect.isTrue(x is int); 30 Expect.isTrue(x is int);
27 Expect.equals(8, b); /// 01: continued 31 Expect.equals(8, b);
28 Expect.equals(8, 1.0 << 3); /// 03: static type warning 32
33 /// 01: continued
34 Expect.equals(8, 1.0 << 3);
35
36 /// 03: static type warning
29 Expect.isTrue(1 == 1.0); 37 Expect.isTrue(1 == 1.0);
30 Expect.equals(0, d); /// 02: continued 38 Expect.equals(0, d);
31 Expect.equals(0, -0.0 << 1); /// 04: static type warning 39
40 /// 02: continued
41 Expect.equals(0, -0.0 << 1);
42
43 /// 04: static type warning
32 // Make sure the 1 is not shifted into the 32 bit range. 44 // Make sure the 1 is not shifted into the 32 bit range.
33 Expect.equals(0, 0x100000000 >> 3); 45 Expect.equals(0, 0x100000000 >> 3);
34 // The dynamic int-check also allows -0.0. 46 // The dynamic int-check also allows -0.0.
35 Expect.isTrue((-0.0) is int); 47 Expect.isTrue((-0.0) is int);
36 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698