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

Unified Diff: pkg/serialization/test/serialization_test.dart

Issue 13982012: Update pkg/serialization to use Symbols and synchronous mirrors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « pkg/serialization/lib/src/serialization_rule.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/serialization/test/serialization_test.dart
diff --git a/pkg/serialization/test/serialization_test.dart b/pkg/serialization/test/serialization_test.dart
index 2987fe09033eda36c7af28e189ec2bc621c7b8ea..0729fdd10ec87ad0b6087c3f8bb74f11fdafaf9c 100644
--- a/pkg/serialization/test/serialization_test.dart
+++ b/pkg/serialization/test/serialization_test.dart
@@ -123,9 +123,16 @@ main() {
var stream = new Stream([3,4,5]);
expect((stream..next()).next(), 4);
expect(stream.position, 2);
+ // The Symbol class does not allow us to create symbols for private
+ // variables. However, the mirror system uses them. So we get the symbol
+ // we want from the mirror.
+ // TODO(alanknight): Either delete this test and decide we shouldn't
+ // attempt to access private variables or fix this properly.
+ var _collectionSym = reflect(stream).type.variables.keys.firstWhere(
+ (x) => MirrorSystem.getName(x) == "_collection");
var s = new Serialization()
..addRuleFor(stream,
- constructorFields: ['_collection']);
+ constructorFields: [_collectionSym]);
var state = states(stream, s).first;
// Define names for the variable offsets to make this more readable.
var _collection = 0, position = 1;
@@ -211,7 +218,7 @@ main() {
var w = new Writer(s);
w.trace = new Trace(w);
w.write(n1);
- expect(w.states.length, 5); // prims, lists, essential lists, basic
+ expect(w.states.length, 6); // prims, lists, essential lists, basic, symbol
var children = 0, name = 1, parent = 2;
var nodeRule = s.rules.firstWhere((x) => x is BasicRule);
List rootNode = w.states[nodeRule.number].where(
« no previous file with comments | « pkg/serialization/lib/src/serialization_rule.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698