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

Unified Diff: tests/language/scope_variable_test.dart

Issue 23944004: Merge two language/scope_ tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/scope_negative_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/scope_variable_test.dart
diff --git a/tests/language/scope_variable_test.dart b/tests/language/scope_variable_test.dart
index d3bca7cc1ea376c779786b683388a00e58d0511c..1437de64dabcf928766ce409c0e931c96dac8b56 100644
--- a/tests/language/scope_variable_test.dart
+++ b/tests/language/scope_variable_test.dart
@@ -4,38 +4,44 @@
import "package:expect/expect.dart";
-class ScopeVariableTest {
-
- static void testSimpleScope() {
- {
- var a = "Test";
- int b = 1;
- }
- {
- var c;
- int d;
- Expect.equals(true, c == null);
- Expect.equals(true, d == null);
- }
+void testSimpleScope() {
+ {
+ var a = "Test";
+ int b = 1;
+ }
+ {
+ var c;
+ int d;
+ Expect.isNull(c);
+ Expect.isNull(d);
}
+}
- static void testShadowingScope() {
- var a = "Test";
- {
- var a;
- Expect.equals(true, a == null);
- a = "a";
- Expect.equals(true, a == "a");
- }
- Expect.equals(true, a == "Test");
+void testShadowingScope() {
+ var a = "Test";
+ {
+ var a;
+ Expect.equals(true, a == null);
+ a = "a";
+ Expect.equals(true, a == "a");
}
+ Expect.equals(true, a == "Test");
+}
- static void testMain() {
- testSimpleScope();
- testShadowingScope();
+int testShadowingAfterUse() {
+ var a = 1;
+ {
+ var b = 2;
+ var c = a; // Use of 'a' prior to its shadow declaration below.
+ var d = b + c;
+ // Shadow declaration of 'a'.
+ var a = 5; /// 01: compile-time error
+ return d + a;
}
}
main() {
- ScopeVariableTest.testMain();
+ testSimpleScope();
+ testShadowingScope();
+ testShadowingAfterUse();
}
« no previous file with comments | « tests/language/scope_negative_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698