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

Unified Diff: dart/tests/try/web/incremental_compilation_update_test.dart

Issue 800443002: Add tests regarding fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tests/try/web/incremental_compilation_update_test.dart
diff --git a/dart/tests/try/web/incremental_compilation_update_test.dart b/dart/tests/try/web/incremental_compilation_update_test.dart
index 5377f3a24ec56b3b08710b674ea3e5bcbb903d41..dc6eb97743270c2297d7078427652444e1a375ae 100644
--- a/dart/tests/try/web/incremental_compilation_update_test.dart
+++ b/dart/tests/try/web/incremental_compilation_update_test.dart
@@ -1397,6 +1397,264 @@ main() {
""",
const <String>['v2']),
],
+
+ // Test that an instance field can be added to a compound declaration.
+ // TODO(ahe): Test doesn't pass.
+ const <ProgramResult>[
+ const ProgramResult(
+ r"""
+class C {
+ int x;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ instance.x = 'v1';
+ } else {
+ instance.y = 'v2';
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+ try {
+ print(instance.y);
+ } catch (e) {
+ print('[instance.y] threw');
+ }
+}
+""",
+ const <String>['[instance] is null', 'v1', '[instance.y] threw']),
+/*
+ const ProgramResult(
+ r"""
+class C {
+ int x, y;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ instance.x = 'v1';
+ } else {
+ instance.y = 'v2';
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+ try {
+ print(instance.y);
+ } catch (e) {
+ print('[instance.y] threw');
+ }
+}
+""",
+ const <String>['v1', 'v2']),
+*/
+ ],
+
+ // Test that an instance field can be removed from a compound declaration.
+ // TODO(ahe): Test doesn't pass.
+ const <ProgramResult>[
+ const ProgramResult(
+ r"""
+class C {
+ int x, y;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ instance.x = 'v1';
+ instance.y = 'v2';
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+ try {
+ print(instance.y);
+ } catch (e) {
+ print('[instance.y] threw');
+ }
+}
+""",
+ const <String>['[instance] is null', 'v1', 'v2']),
+/*
+ const ProgramResult(
+ r"""
+class C {
+ int x;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ instance.x = 'v1';
+ instance.y = 'v2';
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+ try {
+ print(instance.y);
+ } catch (e) {
+ print('[instance.y] threw');
+ }
+}
+""",
+ const <String>['v1', '[instance.y] threw']),
+*/
+ ],
+
+ // Test that a static field can be made an instance field.
+ // TODO(ahe): Test doesn't pass.
+ const <ProgramResult>[
+ const ProgramResult(
+ r"""
+class C {
+ static int x;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ C.x = 'v1';
+ } else {
+ instance.x = 'v2';
+ }
+ try {
+ print(C.x);
+ } catch (e) {
+ print('[C.x] threw');
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+}
+""",
+ const <String>['[instance] is null', 'v1', '[instance.x] threw']),
+/*
+ const ProgramResult(
+ r"""
+class C {
+ int x;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ C.x = 'v1';
+ } else {
+ instance.x = 'v2';
+ }
+ try {
+ print(C.x);
+ } catch (e) {
+ print('[C.x] threw');
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+}
+""",
+ const <String>['[C.x] threw', 'v2']),
+*/
+ ],
+
+ // Test that instance field can be made static.
+ // TODO(ahe): Test doesn't pass.
+ const <ProgramResult>[
+ const ProgramResult(
+ r"""
+class C {
+ int x;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ instance.x = 'v1';
+ } else {
+ C.x = 'v2';
+ }
+ try {
+ print(C.x);
+ } catch (e) {
+ print('[C.x] threw');
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+}
+""",
+ const <String>['[instance] is null', '[C.x] threw', 'v1']),
+/*
+ const ProgramResult(
+ r"""
+class C {
+ static int x;
+}
+
+var instance;
+
+main() {
+ if (instance == null) {
+ print('[instance] is null');
+ instance = new C();
+ instance.x = 'v1';
+ } else {
+ C.x = 'v2';
+ }
+ try {
+ print(C.x);
+ } catch (e) {
+ print('[C.x] threw');
+ }
+ try {
+ print(instance.x);
+ } catch (e) {
+ print('[instance.x] threw');
+ }
+}
+""",
+ const <String>['v2', '[instance.x] threw']),
+*/
+ ],
];
void main() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698