| Index: sdk/lib/_internal/pub_generated/test/transformers_needed_by_transformers/utils.dart
|
| diff --git a/sdk/lib/_internal/pub/test/transformers_needed_by_transformers/utils.dart b/sdk/lib/_internal/pub_generated/test/transformers_needed_by_transformers/utils.dart
|
| similarity index 63%
|
| copy from sdk/lib/_internal/pub/test/transformers_needed_by_transformers/utils.dart
|
| copy to sdk/lib/_internal/pub_generated/test/transformers_needed_by_transformers/utils.dart
|
| index 789dad5dd7faa789ffc6e61fc1af1a84d81a84f6..53829617e7614005673ad7176f8e718297da3f98 100644
|
| --- a/sdk/lib/_internal/pub/test/transformers_needed_by_transformers/utils.dart
|
| +++ b/sdk/lib/_internal/pub_generated/test/transformers_needed_by_transformers/utils.dart
|
| @@ -1,12 +1,6 @@
|
| -// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.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 pub_tests;
|
| -
|
| import 'package:path/path.dart' as p;
|
| import 'package:scheduled_test/scheduled_test.dart';
|
| -
|
| import '../../lib/src/barback/cycle_exception.dart';
|
| import '../../lib/src/barback/transformers_needed_by_transformers.dart';
|
| import '../../lib/src/entrypoint.dart';
|
| @@ -17,13 +11,8 @@ import '../../lib/src/source/path.dart';
|
| import '../../lib/src/system_cache.dart';
|
| import '../../lib/src/utils.dart';
|
| import '../test_pub.dart';
|
| -
|
| -/// Expects that [computeTransformersNeededByTransformers] will return a graph
|
| -/// matching [expected] when run on the package graph defined by packages in
|
| -/// the sandbox.
|
| void expectDependencies(Map<String, Iterable<String>> expected) {
|
| expected = mapMap(expected, value: (_, ids) => ids.toSet());
|
| -
|
| schedule(() {
|
| var result = mapMap(
|
| computeTransformersNeededByTransformers(_loadPackageGraph()),
|
| @@ -32,20 +21,13 @@ void expectDependencies(Map<String, Iterable<String>> expected) {
|
| expect(result, equals(expected));
|
| }, "expect dependencies to match $expected");
|
| }
|
| -
|
| -/// Expects that [computeTransformersNeededByTransformers] will throw an
|
| -/// exception matching [matcher] when run on the package graph defiend by
|
| -/// packages in the sandbox.
|
| void expectException(matcher) {
|
| schedule(() {
|
| - expect(() => computeTransformersNeededByTransformers(_loadPackageGraph()),
|
| + expect(
|
| + () => computeTransformersNeededByTransformers(_loadPackageGraph()),
|
| throwsA(matcher));
|
| }, "expect an exception: $matcher");
|
| }
|
| -
|
| -/// Expects that [computeTransformersNeededByTransformers] will throw a
|
| -/// [CycleException] with the given [steps] when run on the package graph
|
| -/// defiend by packages in the sandbox.
|
| void expectCycleException(Iterable<String> steps) {
|
| expectException(predicate((error) {
|
| expect(error, new isInstanceOf<CycleException>());
|
| @@ -53,59 +35,44 @@ void expectCycleException(Iterable<String> steps) {
|
| return true;
|
| }, "cycle exception:\n${steps.map((step) => " $step").join("\n")}"));
|
| }
|
| -
|
| -/// Loads a [PackageGraph] from the packages in the sandbox.
|
| -///
|
| -/// This graph will also include barback and its transitive dependencies from
|
| -/// the repo.
|
| PackageGraph _loadPackageGraph() {
|
| - // Load the sandbox packages.
|
| var packages = {};
|
| -
|
| var systemCache = new SystemCache(p.join(sandboxDir, cachePath));
|
| systemCache.sources
|
| ..register(new PathSource())
|
| ..setDefault('path');
|
| var entrypoint = new Entrypoint(p.join(sandboxDir, appPath), systemCache);
|
| -
|
| for (var package in listDir(sandboxDir)) {
|
| if (!fileExists(p.join(package, 'pubspec.yaml'))) continue;
|
| var packageName = p.basename(package);
|
| - packages[packageName] = new Package.load(
|
| - packageName, package, systemCache.sources);
|
| + packages[packageName] =
|
| + new Package.load(packageName, package, systemCache.sources);
|
| }
|
| -
|
| loadPackage(packageName) {
|
| if (packages.containsKey(packageName)) return;
|
| packages[packageName] = new Package.load(
|
| - packageName, p.join(pkgPath, packageName), systemCache.sources);
|
| + packageName,
|
| + p.join(pkgPath, packageName),
|
| + systemCache.sources);
|
| for (var dep in packages[packageName].dependencies) {
|
| loadPackage(dep.name);
|
| }
|
| }
|
| -
|
| loadPackage('barback');
|
| -
|
| return new PackageGraph(entrypoint, null, packages);
|
| }
|
| -
|
| -/// Returns the contents of a no-op transformer that imports each URL in
|
| -/// [imports].
|
| String transformer([Iterable<String> imports]) {
|
| if (imports == null) imports = [];
|
| -
|
| - var buffer = new StringBuffer()
|
| - ..writeln('import "package:barback/barback.dart";');
|
| + var buffer =
|
| + new StringBuffer()..writeln('import "package:barback/barback.dart";');
|
| for (var import in imports) {
|
| buffer.writeln('import "$import";');
|
| }
|
| -
|
| buffer.writeln("""
|
| NoOpTransformer extends Transformer {
|
| bool isPrimary(AssetId id) => true;
|
| void apply(Transform transform) {}
|
| }
|
| """);
|
| -
|
| return buffer.toString();
|
| }
|
|
|