| Index: utils/tests/archive/utils_test.dart
|
| diff --git a/utils/tests/archive/utils_test.dart b/utils/tests/archive/utils_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0f8397dd0ba6355abafb1e2f95c58d8f2ad5efb2
|
| --- /dev/null
|
| +++ b/utils/tests/archive/utils_test.dart
|
| @@ -0,0 +1,39 @@
|
| +// 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.
|
| +
|
| +#library('utils_test');
|
| +
|
| +#import('../../../lib/unittest/unittest.dart');
|
| +#import('../../archive/utils.dart');
|
| +
|
| +main() {
|
| + group('attachFinalizer', () {
|
| + test('calls the finalizer eventually once the object is collected', () {
|
| + var finalized = null;
|
| +
|
| + void finalizer(String data) {
|
| + finalized = data;
|
| + }
|
| +
|
| + while (finalized == null) {
|
| + var list = [1, 2, 3];
|
| + attachFinalizer(list, finalizer, 'finally finalized!');
|
| + }
|
| +
|
| + expect(finalized, equals('finally finalized!'));
|
| + });
|
| +
|
| + test("doesn't call the finalizer while the object is in scope", () {
|
| + var finalized = null;
|
| +
|
| + void finalizer(String data) {
|
| + finalized = data;
|
| + }
|
| +
|
| + var list = [1, 2, 3];
|
| + attachFinalizer(list, finalizer, 'finally finalized!');
|
| + expect(finalized, isNull);
|
| + });
|
| + });
|
| +}
|
|
|