| Index: sdk/lib/_internal/pub/test/transformer/mode_defaults_to_release_in_build_test.dart
|
| diff --git a/sdk/lib/_internal/pub/test/transformer/configuration/configuration_defaults_to_empty_map_test.dart b/sdk/lib/_internal/pub/test/transformer/mode_defaults_to_release_in_build_test.dart
|
| similarity index 59%
|
| copy from sdk/lib/_internal/pub/test/transformer/configuration/configuration_defaults_to_empty_map_test.dart
|
| copy to sdk/lib/_internal/pub/test/transformer/mode_defaults_to_release_in_build_test.dart
|
| index e84224573756be3b06fd10af820e12416241073f..5109c82e690a19433de1634ce2c2c78c3057e4d4 100644
|
| --- a/sdk/lib/_internal/pub/test/transformer/configuration/configuration_defaults_to_empty_map_test.dart
|
| +++ b/sdk/lib/_internal/pub/test/transformer/mode_defaults_to_release_in_build_test.dart
|
| @@ -4,29 +4,25 @@
|
|
|
| library pub_tests;
|
|
|
| -import 'dart:convert';
|
| -
|
| -import '../../descriptor.dart' as d;
|
| -import '../../test_pub.dart';
|
| -import '../../serve/utils.dart';
|
| +import '../descriptor.dart' as d;
|
| +import '../test_pub.dart';
|
|
|
| final transformer = """
|
| import 'dart:async';
|
| -import 'dart:convert';
|
|
|
| import 'package:barback/barback.dart';
|
|
|
| -class ConfigTransformer extends Transformer {
|
| - final Map configuration;
|
| +class ModeTransformer extends Transformer {
|
| + final BarbackSettings settings;
|
|
|
| - ConfigTransformer.asPlugin(this.configuration);
|
| + ModeTransformer.asPlugin(this.settings);
|
|
|
| String get allowedExtensions => '.txt';
|
|
|
| Future apply(Transform transform) {
|
| return transform.primaryInput.readAsString().then((contents) {
|
| - var id = transform.primaryInput.id.changeExtension(".json");
|
| - transform.addOutput(new Asset.fromString(id, JSON.encode(configuration)));
|
| + transform.addOutput(
|
| + new Asset.fromString(transform.primaryInput.id, settings.mode.name));
|
| });
|
| }
|
| }
|
| @@ -34,7 +30,7 @@ class ConfigTransformer extends Transformer {
|
|
|
| main() {
|
| initConfig();
|
| - integration("configuration defaults to an empty map", () {
|
| + integration("mode defaults to 'release' in pub build", () {
|
| d.dir(appPath, [
|
| d.pubspec({
|
| "name": "myapp",
|
| @@ -50,8 +46,14 @@ main() {
|
|
|
| createLockFile('myapp', pkg: ['barback']);
|
|
|
| - var server = startPubServe();
|
| - requestShouldSucceed("foo.json", JSON.encode({}));
|
| - endPubServe();
|
| + schedulePub(args: ["build"],
|
| + output: new RegExp(r"Built 1 file!"),
|
| + exitCode: 0);
|
| +
|
| + d.dir(appPath, [
|
| + d.dir('build', [
|
| + d.file('foo.txt', 'release')
|
| + ])
|
| + ]).validate();
|
| });
|
| }
|
|
|