| 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('utils_test'); | 5 #library('utils_test'); |
| 6 | 6 |
| 7 #import('../../../lib/unittest/unittest.dart'); | 7 #import('../../../lib/unittest/unittest.dart'); |
| 8 #import('../../archive/utils.dart'); | 8 #import('../../archive/utils.dart'); |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 // TODO(nweiz): re-enable this once issue 4378 is fixed. |
| 12 return; |
| 13 |
| 11 group('attachFinalizer', () { | 14 group('attachFinalizer', () { |
| 12 test('calls the finalizer eventually once the object is collected', () { | 15 test('calls the finalizer eventually once the object is collected', () { |
| 13 var finalized = null; | 16 var finalized = null; |
| 14 | 17 |
| 15 void finalizer(String data) { | 18 void finalizer(String data) { |
| 16 finalized = data; | 19 finalized = data; |
| 17 } | 20 } |
| 18 | 21 |
| 19 while (finalized == null) { | 22 while (finalized == null) { |
| 20 var list = [1, 2, 3]; | 23 var list = [1, 2, 3]; |
| 21 attachFinalizer(list, finalizer, 'finally finalized!'); | 24 attachFinalizer(list, finalizer, 'finally finalized!'); |
| 22 } | 25 } |
| 23 | 26 |
| 24 expect(finalized, equals('finally finalized!')); | 27 expect(finalized, equals('finally finalized!')); |
| 25 }); | 28 }); |
| 26 | 29 |
| 27 test("doesn't call the finalizer while the object is in scope", () { | 30 test("doesn't call the finalizer while the object is in scope", () { |
| 28 var finalized = null; | 31 var finalized = null; |
| 29 | 32 |
| 30 void finalizer(String data) { | 33 void finalizer(String data) { |
| 31 finalized = data; | 34 finalized = data; |
| 32 } | 35 } |
| 33 | 36 |
| 34 var list = [1, 2, 3]; | 37 var list = [1, 2, 3]; |
| 35 attachFinalizer(list, finalizer, 'finally finalized!'); | 38 attachFinalizer(list, finalizer, 'finally finalized!'); |
| 36 expect(finalized, isNull); | 39 expect(finalized, isNull); |
| 37 }); | 40 }); |
| 38 }); | 41 }); |
| 39 } | 42 } |
| OLD | NEW |