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

Unified Diff: tests/kernel/unsorted/load_store_test.dart

Issue 2451623006: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: Fix Created 4 years, 2 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/kernel/unsorted/let_test.dart ('k') | tests/kernel/unsorted/local_function_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/kernel/unsorted/load_store_test.dart
diff --git a/tests/kernel/unsorted/load_store_test.dart b/tests/kernel/unsorted/load_store_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a9ff4c475e01f6ec0c3269f806858766f10cf9e2
--- /dev/null
+++ b/tests/kernel/unsorted/load_store_test.dart
@@ -0,0 +1,64 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Tests of reading and writing to variables.
+
+import 'expect.dart';
+
+test0() {
+ var x0 = 0, x1;
+ Expect.isTrue(x0 == 0);
+ Expect.isTrue(x1 == null);
+ x0 = 1;
+ Expect.isTrue(x0 == 1);
+ Expect.isTrue((x0 = 2) == 2);
+ Expect.isTrue(x0 == 2);
+}
+
+var x2 = 0, x3;
+
+test1() {
+ Expect.isTrue(x2 == 0);
+ Expect.isTrue(x3 == null);
+ x2 = 1;
+ Expect.isTrue(x2 == 1);
+ Expect.isTrue((x2 = 2) == 2);
+ Expect.isTrue(x2 == 2);
+}
+
+class C {
+ static var x4 = 0;
+ static var x5;
+}
+
+test3() {
+ Expect.isTrue(C.x4 == 0);
+ Expect.isTrue(C.x5 == null);
+ C.x4 = 1;
+ Expect.isTrue(C.x4 == 1);
+ Expect.isTrue((C.x4 = 2) == 2);
+ Expect.isTrue(C.x4 == 2);
+}
+
+class D {
+ var x6 = 0;
+ var x7;
+}
+
+test4() {
+ var d = new D();
+ Expect.isTrue(d.x6 == 0);
+ Expect.isTrue(d.x7 == null);
+ d.x6 = 1;
+ Expect.isTrue(d.x6 == 1);
+ Expect.isTrue((d.x6 = 2) == 2);
+ Expect.isTrue(d.x6 == 2);
+}
+
+main() {
+ test0();
+ test1();
+ test3();
+ test4();
+}
« no previous file with comments | « tests/kernel/unsorted/let_test.dart ('k') | tests/kernel/unsorted/local_function_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698