| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test program for testing serialization of messages without spawning | 5 // Dart test program for testing serialization of messages without spawning |
| 6 // isolates. | 6 // isolates. |
| 7 | 7 |
| 8 // --------------------------------------------------------------------------- | 8 // --------------------------------------------------------------------------- |
| 9 // Serialization test. | 9 // Serialization test. |
| 10 // --------------------------------------------------------------------------- | 10 // --------------------------------------------------------------------------- |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 copyAndVerify([[]], f); | 29 copyAndVerify([[]], f); |
| 30 copyAndVerify([1, []], f); | 30 copyAndVerify([1, []], f); |
| 31 copyAndVerify({}, f); | 31 copyAndVerify({}, f); |
| 32 copyAndVerify({ 'a': 3 }, f); | 32 copyAndVerify({ 'a': 3 }, f); |
| 33 copyAndVerify({ 'a': 3, 'b': 5, 'c': 8 }, f); | 33 copyAndVerify({ 'a': 3, 'b': 5, 'c': 8 }, f); |
| 34 copyAndVerify({ 'a': [1, 2] }, f); | 34 copyAndVerify({ 'a': [1, 2] }, f); |
| 35 copyAndVerify({ 'b': { 'c' : 99 } }, f); | 35 copyAndVerify({ 'b': { 'c' : 99 } }, f); |
| 36 copyAndVerify([ { 'a': 499 }, { 'b': 42 } ], f); | 36 copyAndVerify([ { 'a': 499 }, { 'b': 42 } ], f); |
| 37 | 37 |
| 38 var port = new ReceivePort(); | 38 var port = new ReceivePort(); |
| 39 var transformed = f(port); | 39 Expect.throws(() => f(port)); |
| 40 Expect.equals(port.toSendPort(), transformed); | |
| 41 port.close(); | |
| 42 | |
| 43 port = new ReceivePort.singleShot(); | |
| 44 transformed = f(port); | |
| 45 Expect.equals(port.toSendPort(), transformed); | |
| 46 port.close(); | 40 port.close(); |
| 47 | 41 |
| 48 var a = [ 1, 3, 5 ]; | 42 var a = [ 1, 3, 5 ]; |
| 49 var b = { 'b': 49 }; | 43 var b = { 'b': 49 }; |
| 50 var c = [ a, b, a, b, a ]; | 44 var c = [ a, b, a, b, a ]; |
| 51 var copied = f(c); | 45 var copied = f(c); |
| 52 verify(c, copied); | 46 verify(c, copied); |
| 53 Expect.isFalse(c === copied); | 47 Expect.isFalse(c === copied); |
| 54 Expect.isTrue(copied[0] === copied[2]); | 48 Expect.isTrue(copied[0] === copied[2]); |
| 55 Expect.isTrue(copied[0] === copied[4]); | 49 Expect.isTrue(copied[0] === copied[4]); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 Expect.isTrue(copy is Map); | 68 Expect.isTrue(copy is Map); |
| 75 Expect.equals(o.length, copy.length); | 69 Expect.equals(o.length, copy.length); |
| 76 o.forEach((key, value) { | 70 o.forEach((key, value) { |
| 77 Expect.isTrue(copy.containsKey(key)); | 71 Expect.isTrue(copy.containsKey(key)); |
| 78 verify(value, copy[key]); | 72 verify(value, copy[key]); |
| 79 }); | 73 }); |
| 80 } else { | 74 } else { |
| 81 Expect.fail("Unexpected object encountered"); | 75 Expect.fail("Unexpected object encountered"); |
| 82 } | 76 } |
| 83 } | 77 } |
| OLD | NEW |