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

Side by Side Diff: tests/language/getter_no_setter_test.dart

Issue 2774783002: Re-land "Format all multitests" (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « tests/language/getter_no_setter2_test.dart ('k') | tests/language/getter_parameters_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Verifies behavior with a static getter, but no field and no setter. 4 // Verifies behavior with a static getter, but no field and no setter.
5 5
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 class Example { 8 class Example {
9 static int _var = 1; 9 static int _var = 1;
10 static int get nextVar => _var++; 10 static int get nextVar => _var++;
11 Example() { 11 Example() {
12 { 12 {
13 bool flag_exception = false; 13 bool flag_exception = false;
14 try { 14 try {
15 nextVar = 1; // Equivalent to this.nextVar = 1. 15 nextVar = 1; // Equivalent to this.nextVar = 1.
16 } catch (excpt) { 16 } catch (excpt) {
17 flag_exception = true; 17 flag_exception = true;
18 } 18 }
19 Expect.isTrue(flag_exception); 19 Expect.isTrue(flag_exception);
20 } 20 }
21 { 21 {
22 bool flag_exception = false; 22 bool flag_exception = false;
23 try { 23 try {
24 this.nextVar = 1; // //# 00: static type warning 24 this.nextVar = 1; // //# 00: static type warning
25 } catch (excpt) { 25 } catch (excpt) {
26 flag_exception = true; 26 flag_exception = true;
27 } 27 }
28 Expect.isTrue(flag_exception); // //# 00: continued 28 Expect.isTrue(flag_exception); // //# 00: continued
29 } 29 }
30 } 30 }
31 static test() { 31 static test() {
32 nextVar = 0; // //# 01: runtime error 32 nextVar = 0; // //# 01: runtime error
33 this.nextVar = 0; // //# 02: compile-time error 33 this.nextVar = 0; // //# 02: compile-time error
34 } 34 }
35 } 35 }
36 36
37 class Example1 { 37 class Example1 {
38 Example1(int i) { } 38 Example1(int i) {}
39 } 39 }
40 40
41 class Example2 extends Example1 { 41 class Example2 extends Example1 {
42 static int _var = 1; 42 static int _var = 1;
43 static int get nextVar => _var++; 43 static int get nextVar => _var++;
44 Example2() : super(nextVar) { } // No 'this' in scope. 44 Example2() : super(nextVar) {} // No 'this' in scope.
45 } 45 }
46 46
47 void main() { 47 void main() {
48 Example x = new Example(); 48 Example x = new Example();
49 Example.test(); 49 Example.test();
50 Example2 x2 = new Example2(); 50 Example2 x2 = new Example2();
51 } 51 }
OLDNEW
« no previous file with comments | « tests/language/getter_no_setter2_test.dart ('k') | tests/language/getter_parameters_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698