Index: pkg/serialization/test/test_models.dart |
diff --git a/pkg/serialization/test/test_models.dart b/pkg/serialization/test/test_models.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5ccfaccd6b49bfc5a8cec41b8131d6ec4fd38b9b |
--- /dev/null |
+++ b/pkg/serialization/test/test_models.dart |
@@ -0,0 +1,75 @@ |
+// Copyright (c) 2012, 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. |
+ |
+/** Provides some basic model classes to test serialization. */ |
+ |
+part of serialization_test; |
+ |
+class Person { |
+ String name, rank, serialNumber; |
+ var address; |
+} |
+ |
+class Address { |
+ String street, city, state, zip; |
+ Address(); |
+ Address.withData(this.street, this.city, this.state, this.zip); |
+} |
+ |
+class Various { |
+ Various.Foo(this._d, this.e); |
+ |
+ // Field |
+ var a; |
+ |
+ // Get/Set pair |
+ var _b; |
+ get b => _b; |
+ set b(value) { _b = value; } |
+ |
+ // Private field (shouldn't be visible) |
+ var _c = 'default value'; |
+ |
+ // Getter, value is set in the constructor |
+ var _d; |
+ get d => _d; |
+ |
+ // Final, value set is the constructor. |
+ final e; |
+ |
+ // Get without corresponding set |
+ get aLength => a.length; |
+ |
+ static String thisShouldBeIgnored = "because it's static"; |
+ static get thisShouldAlsoBeIgnored => "for the same reason"; |
+ static set thisShouldAlsoBeIgnored(x) {} |
+} |
+ |
+class Node { |
+ Node parent; |
+ String name; |
+ Node(this.name); |
+ Node.parentEssential(this.parent); |
+ List<Node> children; |
+ bool someBoolean = true; |
+ |
+ toString() => "Node($name)"; |
+} |
+ |
+class NodeEqualByName extends Node { |
+ NodeEqualByName(name) : super(name); |
+ operator ==(x) => x is NodeEqualByName && name == x.name; |
+ get hashCode => name.hashCode; |
+} |
+ |
+class Stream { |
+ // In a real stream the position wouldn't likely be settable, making |
+ // this trickier to reconstruct. |
+ List _collection; |
+ int position = 0; |
+ Stream(this._collection); |
+ |
+ next() => atEnd() ? null : _collection[position++]; |
+ atEnd() => position >= _collection.length; |
+} |