| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 }); | 50 }); |
| 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 .chain((input) => input.readAll()) | 58 .chain((input) => input.readAll()) |
| 59 .transform((entries) { | 59 .transform((entries) { |
| 60 entries = entries.mappedBy((entry) => [entry.pathname, entry.contents.trim
()]); | 60 entries = entries |
| 61 .mappedBy((entry) => [entry.pathname, entry.contents.trim()]) |
| 62 .toList(); |
| 61 expect(entries[0], orderedEquals(["filename1", "contents 1"])); | 63 expect(entries[0], orderedEquals(["filename1", "contents 1"])); |
| 62 expect(entries[1], orderedEquals(["filename2", "contents 2"])); | 64 expect(entries[1], orderedEquals(["filename2", "contents 2"])); |
| 63 expect(entries[2], orderedEquals(["filename3", "contents 3"])); | 65 expect(entries[2], orderedEquals(["filename3", "contents 3"])); |
| 64 }); | 66 }); |
| 65 | 67 |
| 66 expect(future, completes); | 68 expect(future, completes); |
| 67 }); | 69 }); |
| 68 | 70 |
| 69 test('reading an in-memory .tar.gz', () { | 71 test('reading an in-memory .tar.gz', () { |
| 70 var asyncDone = expectAsync0(() {}); | 72 var asyncDone = expectAsync0(() {}); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 test("opening a non-existent archive", () { | 191 test("opening a non-existent archive", () { |
| 190 var reader = new ArchiveReader(); | 192 var reader = new ArchiveReader(); |
| 191 reader.format.tar = true; | 193 reader.format.tar = true; |
| 192 reader.filter.gzip = true; | 194 reader.filter.gzip = true; |
| 193 | 195 |
| 194 expect(reader.openFilename("$dataPath/non-existent.tar.gz"), | 196 expect(reader.openFilename("$dataPath/non-existent.tar.gz"), |
| 195 throwsA((e) => e is ArchiveException)); | 197 throwsA((e) => e is ArchiveException)); |
| 196 }); | 198 }); |
| 197 } | 199 } |
| 198 | 200 |
| OLD | NEW |