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

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

Issue 2453773002: Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork." (Closed)
Patch Set: 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/string_concatenation_test.dart ('k') | tests/kernel/unsorted/super_mixin_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/kernel/unsorted/super_initializer_test.dart
diff --git a/tests/kernel/unsorted/super_initializer_test.dart b/tests/kernel/unsorted/super_initializer_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..fb669df4ec5e79aa0eb37f6c4b7b77474b603dfa
--- /dev/null
+++ b/tests/kernel/unsorted/super_initializer_test.dart
@@ -0,0 +1,48 @@
+// 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.md file.
+
+import 'expect.dart';
+
+String log;
+init() { log = ''; }
+logit(msg) { return log = '$log$msg'; }
+
+class Base {
+ var b;
+ Base.arg0() : b = logit('b') {
+ logit('B');
+ }
+ Base.arg1(a) : b = logit('b') {
+ logit('B');
+ }
+ Base.arg2(a, b) : b = logit('b') {
+ logit('B');
+ }
+}
+
+class Sub extends Base {
+ var x;
+ var s;
+ Sub.arg0() : x = logit('x'), super.arg0(), s = logit('s') {
+ logit('S');
+ }
+ Sub.arg1(a) : x = logit('x'), super.arg1(logit('1')), s = logit('s') {
+ logit('S');
+ }
+ Sub.arg2(a, b) : x = logit('x'), super.arg2(logit('1'), logit('2')), s = logit('s') {
+ logit('S');
+ }
+}
+
+test(fun(), String result) {
+ init();
+ fun();
+ Expect.isTrue(log == result);
+}
+
+main() {
+ test(() => new Sub.arg0(), 'xsbBS');
+ test(() => new Sub.arg1(1), 'x1sbBS');
+ test(() => new Sub.arg2(1, 2), 'x12sbBS');
+}
« no previous file with comments | « tests/kernel/unsorted/string_concatenation_test.dart ('k') | tests/kernel/unsorted/super_mixin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698