| Index: sdk/lib/_internal/pub_generated/test/package_list_files_test.dart
|
| diff --git a/sdk/lib/_internal/pub_generated/test/package_list_files_test.dart b/sdk/lib/_internal/pub_generated/test/package_list_files_test.dart
|
| index 7a2c8616f1960438884a7a63f0931eabd3a89657..d83178953d8260ee5fc5c01a2dfa81194c5fed7c 100644
|
| --- a/sdk/lib/_internal/pub_generated/test/package_list_files_test.dart
|
| +++ b/sdk/lib/_internal/pub_generated/test/package_list_files_test.dart
|
| @@ -1,20 +1,31 @@
|
| +// 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 packages_list_files_test;
|
| +
|
| import 'package:path/path.dart' as path;
|
| import 'package:scheduled_test/scheduled_test.dart';
|
| +
|
| import '../lib/src/entrypoint.dart';
|
| import '../lib/src/io.dart';
|
| import '../lib/src/system_cache.dart';
|
| import 'descriptor.dart' as d;
|
| import 'test_pub.dart';
|
| +
|
| String root;
|
| Entrypoint entrypoint;
|
| +
|
| main() {
|
| initConfig();
|
| +
|
| group('not in a git repo', () {
|
| setUp(() {
|
| d.appDir().create();
|
| scheduleEntrypoint();
|
| });
|
| +
|
| +
|
| integration('lists files recursively', () {
|
| d.dir(
|
| appPath,
|
| @@ -26,6 +37,7 @@ main() {
|
| [
|
| d.file('subfile1.txt', 'subcontents'),
|
| d.file('subfile2.txt', 'subcontents')])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(),
|
| @@ -38,14 +50,17 @@ main() {
|
| path.join(root, 'subdir', 'subfile2.txt')]));
|
| });
|
| });
|
| +
|
| commonTests();
|
| });
|
| +
|
| group('with git', () {
|
| setUp(() {
|
| ensureGit();
|
| d.git(appPath, [d.appPubspec()]).create();
|
| scheduleEntrypoint();
|
| });
|
| +
|
| integration("includes files that are or aren't checked in", () {
|
| d.dir(
|
| appPath,
|
| @@ -57,6 +72,7 @@ main() {
|
| [
|
| d.file('subfile1.txt', 'subcontents'),
|
| d.file('subfile2.txt', 'subcontents')])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(),
|
| @@ -69,6 +85,7 @@ main() {
|
| path.join(root, 'subdir', 'subfile2.txt')]));
|
| });
|
| });
|
| +
|
| integration("ignores files that are gitignored if desired", () {
|
| d.dir(
|
| appPath,
|
| @@ -81,6 +98,7 @@ main() {
|
| [
|
| d.file('subfile1.txt', 'subcontents'),
|
| d.file('subfile2.text', 'subcontents')])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(useGitIgnore: true),
|
| @@ -91,6 +109,7 @@ main() {
|
| path.join(root, 'file2.text'),
|
| path.join(root, 'subdir', 'subfile2.text')]));
|
| });
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(),
|
| @@ -103,39 +122,48 @@ main() {
|
| path.join(root, 'subdir', 'subfile2.text')]));
|
| });
|
| });
|
| +
|
| commonTests();
|
| });
|
| }
|
| +
|
| void scheduleEntrypoint() {
|
| schedule(() {
|
| root = path.join(sandboxDir, appPath);
|
| entrypoint = new Entrypoint(root, new SystemCache.withSources(root));
|
| }, 'initializing entrypoint');
|
| +
|
| currentSchedule.onComplete.schedule(() {
|
| entrypoint = null;
|
| }, 'nulling entrypoint');
|
| }
|
| +
|
| void commonTests() {
|
| integration('ignores broken symlinks', () {
|
| + // Windows requires us to symlink to a directory that actually exists.
|
| d.dir(appPath, [d.dir('target')]).create();
|
| scheduleSymlink(path.join(appPath, 'target'), path.join(appPath, 'link'));
|
| schedule(() => deleteEntry(path.join(sandboxDir, appPath, 'target')));
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(),
|
| equals([path.join(root, 'pubspec.yaml')]));
|
| });
|
| });
|
| +
|
| integration('ignores pubspec.lock files', () {
|
| d.dir(
|
| appPath,
|
| [d.file('pubspec.lock'), d.dir('subdir', [d.file('pubspec.lock')])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(),
|
| equals([path.join(root, 'pubspec.yaml')]));
|
| });
|
| });
|
| +
|
| integration('ignores packages directories', () {
|
| d.dir(
|
| appPath,
|
| @@ -143,17 +171,20 @@ void commonTests() {
|
| d.dir('packages', [d.file('file.txt', 'contents')]),
|
| d.dir(
|
| 'subdir',
|
| - [d.dir('packages', [d.file('subfile.txt', 'subcontents')])])]).create();
|
| + [d.dir('packages', [d.file('subfile.txt', 'subcontents')]),])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(),
|
| equals([path.join(root, 'pubspec.yaml')]));
|
| });
|
| });
|
| +
|
| integration('allows pubspec.lock directories', () {
|
| d.dir(
|
| appPath,
|
| - [d.dir('pubspec.lock', [d.file('file.txt', 'contents')])]).create();
|
| + [d.dir('pubspec.lock', [d.file('file.txt', 'contents'),])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(),
|
| @@ -163,6 +194,7 @@ void commonTests() {
|
| path.join(root, 'pubspec.lock', 'file.txt')]));
|
| });
|
| });
|
| +
|
| group('and "beneath"', () {
|
| integration('only lists files beneath the given root', () {
|
| d.dir(
|
| @@ -179,7 +211,8 @@ void commonTests() {
|
| 'subsubdir',
|
| [
|
| d.file('subsubfile1.txt', 'subsubcontents'),
|
| - d.file('subsubfile2.txt', 'subsubcontents')])])]).create();
|
| + d.file('subsubfile2.txt', 'subsubcontents'),])])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(beneath: path.join(root, 'subdir')),
|
| @@ -191,6 +224,7 @@ void commonTests() {
|
| path.join(root, 'subdir', 'subsubdir', 'subsubfile2.txt')]));
|
| });
|
| });
|
| +
|
| integration("doesn't care if the root is blacklisted", () {
|
| d.dir(
|
| appPath,
|
| @@ -207,6 +241,7 @@ void commonTests() {
|
| [
|
| d.file('subsubfile1.txt', 'subsubcontents'),
|
| d.file('subsubfile2.txt', 'subsubcontents')])])]).create();
|
| +
|
| schedule(() {
|
| expect(
|
| entrypoint.root.listFiles(beneath: path.join(root, 'packages')),
|
|
|