diff --git a/utils/tests/archive/data/test-archive.tar.gz b/utils/tests/archive/data/test-archive.tar.gz deleted file mode 100644 index a5e83364d56..00000000000 Binary files a/utils/tests/archive/data/test-archive.tar.gz and /dev/null differ diff --git a/utils/tests/archive/reader_test.dart b/utils/tests/archive/reader_test.dart deleted file mode 100644 index e95d5ddcf0e..00000000000 --- a/utils/tests/archive/reader_test.dart +++ /dev/null @@ -1,200 +0,0 @@ -// 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 reader_test; - -import 'dart:io'; -import '../../../pkg/unittest/lib/unittest.dart' -import '../../archive/archive.dart'; - -final String dataPath = "utils/tests/archive/data"; - -main() { - test('reading a .tar.gz file', () { - var asyncDone = expectAsync0(() {}); - - var reader = new ArchiveReader(); - reader.format.tar = true; - reader.filter.gzip = true; - - var future = reader.openFilename("$dataPath/test-archive.tar.gz") - .then((input) { - var log = []; - input.onEntry = (entry) => guardAsync(() { - log.add("Entry: ${entry.pathname}"); - var stream = new StringInputStream(entry.openInputStream()); - stream.onData = () => log.add("Contents: ${stream.read().trim()}"); - stream.onClosed = () => log.add("Closed: ${entry.pathname}"); - }); - input.onError = registerException; - - input.onClosed = () => guardAsync(() { - expect(log, orderedEquals([ - "Entry: filename1", - "Contents: contents 1", - "Closed: filename1", - - "Entry: filename2", - "Contents: contents 2", - "Closed: filename2", - - "Entry: filename3", - "Contents: contents 3", - "Closed: filename3", - ])); - }, asyncDone); - }); - - expect(future, completes); - }); - - test('reading a .tar.gz file with readAll', () { - var reader = new ArchiveReader(); - reader.format.tar = true; - reader.filter.gzip = true; - - var future = reader.openFilename("$dataPath/test-archive.tar.gz") - .then((input) => input.readAll()) - .then((entries) { - entries = entries - .map((entry) => [entry.pathname, entry.contents.trim()]) - .toList(); - expect(entries[0], orderedEquals(["filename1", "contents 1"])); - expect(entries[1], orderedEquals(["filename2", "contents 2"])); - expect(entries[2], orderedEquals(["filename3", "contents 3"])); - }); - - expect(future, completes); - }); - - test('reading an in-memory .tar.gz', () { - var asyncDone = expectAsync0(() {}); - - var reader = new ArchiveReader(); - reader.format.tar = true; - reader.filter.gzip = true; - - var future = new File("$dataPath/test-archive.tar.gz").readAsBytes() - .then((bytes) => reader.openData(bytes)) - .then((input) { - var log = []; - input.onEntry = (entry) => guardAsync(() { - log.add("Entry: ${entry.pathname}"); - var stream = new StringInputStream(entry.openInputStream()); - stream.onData = () => log.add("Contents: ${stream.read().trim()}"); - stream.onClosed = () => log.add("Closed: ${entry.pathname}"); - }); - input.onError = registerException; - - input.onClosed = () => guardAsync(() { - expect(log, orderedEquals([ - "Entry: filename1", - "Contents: contents 1", - "Closed: filename1", - - "Entry: filename2", - "Contents: contents 2", - "Closed: filename2", - - "Entry: filename3", - "Contents: contents 3", - "Closed: filename3", - ])); - }, asyncDone); - }); - - expect(future, completes); - }); - - test("closing entries before they're read", () { - var asyncDone = expectAsync0(() {}); - - var reader = new ArchiveReader(); - reader.format.tar = true; - reader.filter.gzip = true; - - var future = reader.openFilename("$dataPath/test-archive.tar.gz") - .then((input) { - var log = []; - input.onEntry = (entry) => guardAsync(() { - log.add("Entry: ${entry.pathname}"); - var underlyingStream = entry.openInputStream(); - var stream = new StringInputStream(underlyingStream); - stream.onData = () => log.add("Contents: ${stream.read().trim()}"); - stream.onClosed = () => log.add("Closed: ${entry.pathname}"); - underlyingStream.close(); - }); - input.onError = registerException; - - input.onClosed = () => guardAsync(() { - expect(log, orderedEquals([ - "Entry: filename1", - "Closed: filename1", - - "Entry: filename2", - "Closed: filename2", - - "Entry: filename3", - "Closed: filename3", - ])); - }, asyncDone); - }); - - expect(future, completes); - }); - - test("closing an archive stream before it's finished", () { - var asyncDone = expectAsync0(() {}); - - var reader = new ArchiveReader(); - reader.format.tar = true; - reader.filter.gzip = true; - - var future = reader.openFilename("$dataPath/test-archive.tar.gz") - .then((input) { - var count = 0; - - var log = []; - input.onEntry = (entry) => guardAsync(() { - count += 1; - - log.add("Entry: ${entry.pathname}"); - var underlyingStream = entry.openInputStream(); - var stream = new StringInputStream(underlyingStream); - stream.onData = () => log.add("Contents: ${stream.read().trim()}"); - stream.onClosed = () => log.add("Closed: ${entry.pathname}"); - - if (count == 2) { - input.close(); - expect(input.closed); - } - }); - input.onError = registerException; - - input.onClosed = () { - expect(log, orderedEquals([ - "Entry: filename1", - "Contents: contents 1", - "Closed: filename1", - - "Entry: filename2", - "Closed: filename2", - ])); - asyncDone(); - }; - }); - - expect(future, completes); - }); - - test("opening a non-existent archive", () { - var reader = new ArchiveReader(); - reader.format.tar = true; - reader.filter.gzip = true; - - expect(reader.openFilename("$dataPath/non-existent.tar.gz"), - throwsA((e) => e is ArchiveException)); - }); -} - diff --git a/utils/tests/archive/utils_test.dart b/utils/tests/archive/utils_test.dart deleted file mode 100644 index bd51d75ff69..00000000000 --- a/utils/tests/archive/utils_test.dart +++ /dev/null @@ -1,42 +0,0 @@ -// 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 '../../../pkg/unittest/lib/unittest.dart'; -import '../../archive/utils.dart'; - -main() { - // TODO(nweiz): re-enable this once issue 4378 is fixed. - return; - - 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); - }); - }); -}