OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library serialization_test; | 5 library serialization_test; |
6 | 6 |
7 import 'dart:json' as json; | 7 import 'dart:json' as json; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'package:serialization/serialization.dart'; | 9 import 'package:serialization/serialization.dart'; |
10 import 'package:serialization/src/serialization_helpers.dart'; | 10 import 'package:serialization/src/serialization_helpers.dart'; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // returns a blank serialization, to make sure it will fail | 241 // returns a blank serialization, to make sure it will fail |
242 // the second time. | 242 // the second time. |
243 var s; | 243 var s; |
244 oneShotSetup(node) { | 244 oneShotSetup(node) { |
245 if (s == null) { | 245 if (s == null) { |
246 s = nodeSerializerReflective(node)..selfDescribing = true; | 246 s = nodeSerializerReflective(node)..selfDescribing = true; |
247 return s; | 247 return s; |
248 } else { | 248 } else { |
249 s = null; | 249 s = null; |
250 return new Serialization.blank() | 250 return new Serialization.blank() |
251 ..namedObjects['Node'] = reflect(new Node('')).type;; | 251 ..namedObjects['Node'] = reflect(new Node('')).type; |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 runRoundTripTest(oneShotSetup); | 255 runRoundTripTest(oneShotSetup); |
256 }); | 256 }); |
257 | 257 |
258 test('round-trip ClosureRule', () { | 258 test('round-trip ClosureRule', () { |
259 runRoundTripTest(nodeSerializerNonReflective); | 259 runRoundTripTest(nodeSerializerNonReflective); |
260 }); | 260 }); |
261 | 261 |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 804 |
805 /** | 805 /** |
806 * Function used in an isolate to make sure that the output passes through | 806 * Function used in an isolate to make sure that the output passes through |
807 * isolate serialization properly. | 807 * isolate serialization properly. |
808 */ | 808 */ |
809 void echo() { | 809 void echo() { |
810 port.receive((msg, reply) { | 810 port.receive((msg, reply) { |
811 reply.send(msg); | 811 reply.send(msg); |
812 }); | 812 }); |
813 } | 813 } |
OLD | NEW |