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

Unified Diff: utils/tests/archive/utils_test.dart

Issue 10825139: Free the C memory for ArchiveInputStream when the stream is garbage collected. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix a renamed function Created 8 years, 5 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
« utils/archive/input_stream.dart ('K') | « utils/archive/utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ });
+ });
+}
« utils/archive/input_stream.dart ('K') | « utils/archive/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698