Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Re-organize repo (#83)
Browse files Browse the repository at this point in the history
Before, package:file/testing.dart was a library containing testing
utilities.  That library depended on package:test.  However, we
explicitly didn't declare a dependency on `test` in the pubspec.yaml
because most users of package:file don't want that dependency.

Unfortunately, there's no way to have library-specific sections within
a pubspec.yaml.  So in order to declare that those testing utilities
did in fact depend on `package:test`, we had to publish them as a
separate package.  This change does just that, as `package:file_testing`.
  • Loading branch information
tvolkert authored Apr 10, 2018
1 parent db0b529 commit 89c46bf
Show file tree
Hide file tree
Showing 95 changed files with 151 additions and 22 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
.buildlog
.dart_tool/
.pub/
build/
packages
.packages

# Or the files created by dart2js.
Expand Down
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: dart

dart:
- dev

dart_task:
- test
- dartanalyzer
- dartfmt
env:
- SHARD=dartfmt
- SHARD=analyze
- SHARD=tests
install:
- ./dev/bots/travis_install.sh
script:
- ./dev/bots/travis_script.sh
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ install:
- ps: wget https://storage.googleapis.com/dart-archive/channels/dev/release/latest/sdk/dartsdk-windows-x64-release.zip -OutFile dart-sdk.zip
- cmd: echo "Unzipping dart-sdk..."
- cmd: 7z x dart-sdk.zip -o"C:\tools" -y > nul
- ps: refreshenv
- set PATH=%PATH%;C:\tools\dart-sdk\bin
- set PATH=%PATH%;%APPDATA%\Pub\Cache\bin
- cmd: cd packages\file
- ps: pwd
- pub get
- cmd: pub get

build: off

Expand Down
20 changes: 20 additions & 0 deletions dev/bots/travis_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -ex

echo "$PWD"

export PATH="$HOME/dart-sdk/bin:$PATH"
export ROOT="$PWD"
export PACKAGES=("file" "file_testing")

wget \
--tries=3 \
--output-document=dart-sdk.zip \
https://storage.googleapis.com/dart-archive/channels/dev/release/latest/sdk/dartsdk-linux-x64-release.zip
echo "Unzipping dart-sdk..."
unzip dart-sdk.zip -d "$HOME" > /dev/null

for package in "${PACKAGES[@]}"; do
cd $ROOT/packages/$package
pub get
done
20 changes: 20 additions & 0 deletions dev/bots/travis_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -ex

export PATH="$HOME/dart-sdk/bin:$PATH"
export ROOT="$PWD"
export PACKAGES=("file" "file_testing")

if [[ "$SHARD" == "dartfmt" ]]; then
dartfmt --dry-run --set-exit-if-changed packages || exit $?
elif [[ "$SHARD" == "analyze" ]]; then
for package in "${PACKAGES[@]}"; do
echo "Analyzing packages/$package"
cd $ROOT/packages/$package
dartanalyzer --options=$ROOT/analysis_options.yaml . || exit $?
done
else
# tests shard
cd $ROOT/packages/file
pub run test -j1 -rexpanded || exit $?
fi
6 changes: 6 additions & 0 deletions CHANGELOG.md → packages/file/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#### 5.0.0

* Moved `testing` library into a dedicated `package:file_testing` so that
libraries don't need to take on a transitive dependency on `package:test`
in order to use `package:file`.

#### 4.0.1

* General library cleanup
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions README.md → packages/file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

A generic file system abstraction for Dart.

## Features

Like `dart:io`, `package:file` supplies a rich Dart-idiomatic API for accessing
a file system.

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion pubspec.yaml → packages/file/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: file
version: 4.0.1
version: 5.0.0
authors:
- Matan Lurey <matanl@google.com>
- Yegor Jbanov <yjbanov@google.com>
Expand All @@ -14,6 +14,7 @@ dependencies:

dev_dependencies:
test: ^0.12.33
file_testing: '>=2.0.0 <3.0.0'

environment:
sdk: '>=2.0.0-dev.28.0 <2.0.0'
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:file/chroot.dart';
import 'package:file/file.dart';
import 'package:file/local.dart';
import 'package:file/memory.dart';
import 'package:file/testing.dart';
import 'package:file_testing/file_testing.dart';
import 'package:test/test.dart';

import 'common_tests.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'dart:convert';
import 'dart:io' as io;

import 'package:file/file.dart';
import 'package:file/testing.dart';
import 'package:file_testing/file_testing.dart';
import 'package:path/path.dart' as p;
import 'package:test/test.dart';
import 'package:test/test.dart' as testpkg show group, setUp, tearDown, test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import 'dart:io' as io;

import 'package:file/local.dart';
import 'package:file/src/testing/internal.dart';
import 'package:file_testing/src/testing/internal.dart';
import 'package:test/test.dart';

import 'common_tests.dart';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:file/record_replay.dart';
import 'package:file/src/backends/record_replay/common.dart' hide TypeMatcher;
import 'package:file/src/backends/record_replay/common.dart'
show getSymbolName; // ignore: implementation_imports
import 'package:test/test.dart';

const Map<Type, String> _kTypeDescriptions = const <Type, String>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ import 'dart:convert';
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:file/record_replay.dart';
import 'package:file/testing.dart';
import 'package:file/src/backends/record_replay/codecs.dart';
import 'package:file/src/backends/record_replay/common.dart';
import 'package:file/src/backends/record_replay/events.dart';
import 'package:file/src/backends/record_replay/mutable_recording.dart';
import 'package:file/src/backends/record_replay/recording_proxy_mixin.dart';
import 'package:file_testing/file_testing.dart';
import 'package:path/path.dart' as p;
import 'package:test/test.dart';

import 'common_tests.dart';
import 'record_replay_matchers.dart';

void main() {
group('SupportingCode', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import 'dart:async';
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:file/record_replay.dart';
import 'package:file/testing.dart';
import 'package:file_testing/file_testing.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';

import 'common_tests.dart';
import 'record_replay_matchers.dart';

void main() {
group('Replay', () {
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions packages/file_testing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#### 2.0.0

* Removed `record_replay_matchers.dart` from API

#### 1.0.0

* Moved `package:file/testing.dart` library into a dedicated package so that
libraries don't need to take on a transitive dependency on `package:test`
in order to use `package:file`.
26 changes: 26 additions & 0 deletions packages/file_testing/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2017, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 changes: 32 additions & 0 deletions packages/file_testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# file_testing

Testing utilities intended to work with `package:file`

## Features

This package provides a series of matchers to be used in tests that work with file
system types.

## Usage

```dart
import 'package:file/file.dart';
import 'package:file_testing/file_testing.dart';
import 'package:test/test.dart';
test('some test', () {
MemoryFileSystem fs;
setUp(() {
fs = new MemoryFileSystem();
fs.file('/foo').createSync();
});
expectFileSystemException(ErrorCodes.ENOENT, () {
fs.directory('').resolveSymbolicLinksSync();
});
expect(fs.file('/path/to/file'), isFile);
expect(fs.file('/path/to/directory'), isDirectory);
expect(fs.file('/foo'), exists);
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@

/// Matchers (from `package:test`) for use in tests that deal with file systems.
export 'src/testing/core_matchers.dart';
export 'src/testing/record_replay_matchers.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// 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.

import 'package:file/file.dart';
import 'dart:io';

import 'package:test/test.dart';

import 'internal.dart';
Expand Down
13 changes: 13 additions & 0 deletions packages/file_testing/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: file_testing
version: 2.0.0
authors:
- Todd Volkert <tvolkert@google.com>
description: Testing utilities for package:file
homepage: https://github.com/google/file.dart/packages/file_testing

dependencies:
meta: ^1.1.2
test: ^0.12.33

environment:
sdk: '>=2.0.0-dev.28.0 <2.0.0'

0 comments on commit 89c46bf

Please sign in to comment.