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 reader_test; | 5 library reader_test; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import '../../../pkg/unittest/lib/unittest.dart' | 8 import '../../../pkg/unittest/lib/unittest.dart' |
9 import '../../archive/archive.dart'; | 9 import '../../archive/archive.dart'; |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 test('reading a .tar.gz file with readAll', () { | 52 test('reading a .tar.gz file with readAll', () { |
53 var reader = new ArchiveReader(); | 53 var reader = new ArchiveReader(); |
54 reader.format.tar = true; | 54 reader.format.tar = true; |
55 reader.filter.gzip = true; | 55 reader.filter.gzip = true; |
56 | 56 |
57 var future = reader.openFilename("$dataPath/test-archive.tar.gz") | 57 var future = reader.openFilename("$dataPath/test-archive.tar.gz") |
58 .then((input) => input.readAll()) | 58 .then((input) => input.readAll()) |
59 .then((entries) { | 59 .then((entries) { |
60 entries = entries | 60 entries = entries |
61 .mappedBy((entry) => [entry.pathname, entry.contents.trim()]) | 61 .map((entry) => [entry.pathname, entry.contents.trim()]) |
62 .toList(); | 62 .toList(); |
63 expect(entries[0], orderedEquals(["filename1", "contents 1"])); | 63 expect(entries[0], orderedEquals(["filename1", "contents 1"])); |
64 expect(entries[1], orderedEquals(["filename2", "contents 2"])); | 64 expect(entries[1], orderedEquals(["filename2", "contents 2"])); |
65 expect(entries[2], orderedEquals(["filename3", "contents 3"])); | 65 expect(entries[2], orderedEquals(["filename3", "contents 3"])); |
66 }); | 66 }); |
67 | 67 |
68 expect(future, completes); | 68 expect(future, completes); |
69 }); | 69 }); |
70 | 70 |
71 test('reading an in-memory .tar.gz', () { | 71 test('reading an in-memory .tar.gz', () { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 test("opening a non-existent archive", () { | 191 test("opening a non-existent archive", () { |
192 var reader = new ArchiveReader(); | 192 var reader = new ArchiveReader(); |
193 reader.format.tar = true; | 193 reader.format.tar = true; |
194 reader.filter.gzip = true; | 194 reader.filter.gzip = true; |
195 | 195 |
196 expect(reader.openFilename("$dataPath/non-existent.tar.gz"), | 196 expect(reader.openFilename("$dataPath/non-existent.tar.gz"), |
197 throwsA((e) => e is ArchiveException)); | 197 throwsA((e) => e is ArchiveException)); |
198 }); | 198 }); |
199 } | 199 } |
200 | 200 |
OLD | NEW |