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

Unified Diff: pkg/fasta/test/accessors.dart

Issue 2631613003: Add Fasta tests. (Closed)
Patch Set: Created 3 years, 11 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
Index: pkg/fasta/test/accessors.dart
diff --git a/pkg/fasta/test/accessors.dart b/pkg/fasta/test/accessors.dart
new file mode 100644
index 0000000000000000000000000000000000000000..453e61fdd577df707b24ba630c0cb4af66d3e9c8
--- /dev/null
+++ b/pkg/fasta/test/accessors.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 file.
+
+void set onlySetter(value) {
+ print("onlySetter called with $value.");
+}
+
+class C {
+ void set onlySetter(value) {
+ print("C.onlySetter called with $value.");
+ }
+
+ testC() {
+ try {
+ print(onlySetter);
+ throw "No error thrown";
+ } on NoSuchMethodError catch (e) {
+ print("Expected error: $e");
+ }
+ onlySetter = "hest";
+ }
+
+ testD() {
+ print(onlySetter);
+ onlySetter = "hest";
+ }
+}
+
+class D extends C {
+ String get onlySetter() => "D.onlySetter called.";
+
+ void set onlySetter(value) {
+ print("D.onlySetter called with $value.");
+ }
+}
+
+main() {
+ try {
+ print(onlySetter);
+ throw "No error thrown";
+ } on NoSuchMethodError catch (e) {
+ print("Expected error: $e");
+ }
+ onlySetter = "fisk";
+ new C().testC();
+ new D().testD();
+}

Powered by Google App Engine
This is Rietveld 408576698