Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

* `FileDescriptor.validate()` now allows invalid UTF-8 files.

* Fix a bug where `DirectoryDescriptor.load()` would incorrectly report that
multiple versions of a file or directory existed.

## 1.0.0

* Initial version.
4 changes: 2 additions & 2 deletions lib/src/directory_descriptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ class DirectoryDescriptor extends Descriptor {
var file = split.length == 1;
var matchingEntries = contents.where((entry) {
return entry.name == split.first &&
file
(file
? entry is FileDescriptor
: entry is DirectoryDescriptor;
: entry is DirectoryDescriptor);
}).toList();

var type = file ? 'file' : 'directory';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test_descriptor
version: 1.0.0
version: 1.0.1
description: An API for defining and verifying directory structures.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/test_descriptor
Expand Down
9 changes: 7 additions & 2 deletions test/directory_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,21 @@ void main() {

group("load()", () {
test("loads a file", () {
var dir = d.dir('dir', [d.file('name.txt', 'contents')]);
var dir = d.dir('dir', [
d.file('name.txt', 'contents'),
d.file('other.txt', 'wrong')
]);
expect(UTF8.decodeStream(dir.load('name.txt')),
completion(equals('contents')));
});

test("loads a deeply-nested file", () {
var dir = d.dir('dir', [
d.dir('subdir', [
d.file('name.txt', 'subcontents')
d.file('name.txt', 'subcontents'),
d.file('other.txt', 'wrong')
]),
d.dir('otherdir', [d.file('other.txt', 'wrong')]),
d.file('name.txt', 'contents')
]);

Expand Down