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

Side by Side Diff: tests/compiler/dart2js_extra/if_null_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 @NoInline() @AssumeDynamic() 7 @NoInline()
8 @AssumeDynamic()
8 confuse(x) => x; 9 confuse(x) => x;
9 10
10 main(args) { 11 main(args) {
11 var x = new A(); 12 var x = new A();
12 var y; 13 var y;
13 14
14 // Checks that inference doesn't incorrectly treat this as a normal 15 // Checks that inference doesn't incorrectly treat this as a normal
15 // assignment (where only B is a possible value after the assignment). 16 // assignment (where only B is a possible value after the assignment).
16 var c = x ??= new B(); 17 var c = x ??= new B();
17 var z = x; 18 var z = x;
18 Expect.equals('a', x.m()); 19 Expect.equals('a', x.m());
19 Expect.equals('a', z.m()); 20 Expect.equals('a', z.m());
20 Expect.equals('a', c.m()); 21 Expect.equals('a', c.m());
21 if (confuse(true)) y = x; 22 if (confuse(true)) y = x;
22 Expect.equals('a', y.m()); 23 Expect.equals('a', y.m());
23 24
24 // Similar test, within fields. 25 // Similar test, within fields.
25 new C(); 26 new C();
26 new D(); 27 new D();
27 } 28 }
28 29
29 class A { m() => 'a'; } 30 class A {
30 class B { m() => 'b'; } 31 m() => 'a';
32 }
33
34 class B {
35 m() => 'b';
36 }
31 37
32 class C { 38 class C {
33 var y; 39 var y;
34 C() { 40 C() {
35 y = new A(); 41 y = new A();
36 var c = y ??= new B(); 42 var c = y ??= new B();
37 Expect.equals('a', y.m()); 43 Expect.equals('a', y.m());
38 Expect.equals('a', c.m()); 44 Expect.equals('a', c.m());
39 } 45 }
40 } 46 }
41 47
42 class D { 48 class D {
43 var y; 49 var y;
44 D() { 50 D() {
45 this.y = new A(); 51 this.y = new A();
46 var c = this.y ??= new B(); 52 var c = this.y ??= new B();
47 Expect.equals('a', y.m()); 53 Expect.equals('a', y.m());
48 Expect.equals('a', c.m()); 54 Expect.equals('a', c.m());
49 } 55 }
50 } 56 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_extra/if_in_loop_test.dart ('k') | tests/compiler/dart2js_extra/if_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698