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

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

Issue 23638006: Merge two static_final_field tests and rewrite a negative test to a multi-test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 void testSimpleScope() { 7 void testSimpleScope() {
8 { 8 {
9 var a = "Test"; 9 var a = "Test";
10 int b = 1; 10 int b = 1;
11 } 11 }
12 { 12 {
13 var c; 13 var c;
14 int d; 14 int d;
15 Expect.isNull(c); 15 Expect.isNull(c);
16 Expect.isNull(d); 16 Expect.isNull(d);
17 } 17 }
18 } 18 }
19 19
20 void testShadowingScope() { 20 void testShadowingScope() {
21 var a = "Test"; 21 var a = "Test";
22 { 22 {
23 var a; 23 var a;
24 Expect.equals(true, a == null); 24 Expect.isNull(a);
25 a = "a"; 25 a = "a";
26 Expect.equals(true, a == "a"); 26 Expect.equals(a, "a");
27 } 27 }
28 Expect.equals(true, a == "Test"); 28 Expect.equals(a, "Test");
29 } 29 }
30 30
31 int testShadowingAfterUse() { 31 int testShadowingAfterUse() {
32 var a = 1; 32 var a = 1;
33 { 33 {
34 var b = 2; 34 var b = 2;
35 var c = a; // Use of 'a' prior to its shadow declaration below. 35 var c = a; // Use of 'a' prior to its shadow declaration below.
36 var d = b + c; 36 var d = b + c;
37 // Shadow declaration of 'a'. 37 // Shadow declaration of 'a'.
38 var a = 5; /// 01: compile-time error 38 var a = 5; /// 01: compile-time error
39 return d + a; 39 return d + a;
40 } 40 }
41 } 41 }
42 42
43 main() { 43 main() {
44 testSimpleScope(); 44 testSimpleScope();
45 testShadowingScope(); 45 testShadowingScope();
46 testShadowingAfterUse(); 46 testShadowingAfterUse();
47 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698