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

Unified Diff: test_reflectable/test/new_instance_default_values_test.dart

Issue 1181413005: Implement newInstance in the transformer. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Address review Created 5 years, 6 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 | « test_reflectable/pubspec.yaml ('k') | test_reflectable/test/new_instance_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test_reflectable/test/new_instance_default_values_test.dart
diff --git a/test_reflectable/test/new_instance_default_values_test.dart b/test_reflectable/test/new_instance_default_values_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6ca662a592080388fc391495449b3983fb589571
--- /dev/null
+++ b/test_reflectable/test/new_instance_default_values_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2015, the Dart Team. All rights reserved. Use of this
+// source code is governed by a BSD-style license that can be found in
+// the LICENSE file.
+
+// File being transformed by the reflectable transformer.
+// Uses `invoke`.
+
+library reflectable.test.to_be_transformed.new_instance_test;
+
+import 'package:reflectable/reflectable.dart';
+import 'package:unittest/unittest.dart';
+
+class MyReflectable extends Reflectable {
+ const MyReflectable() : super(newInstanceCapability);
+}
+
+const myReflectable = const MyReflectable();
+
+@myReflectable
+class A {
+ static const localConstant = 10;
+ A.optional([int z = localConstant]) : f = z;
+ int f = 0;
+}
+
+main() {
+ ClassMirror classMirror = myReflectable.reflectType(A);
+ test('newInstance named arguments default argument, local constant', () {
+ expect((classMirror.newInstance("optional", [], {}) as A).f, 10);
+ });
+}
« no previous file with comments | « test_reflectable/pubspec.yaml ('k') | test_reflectable/test/new_instance_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698