Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Side by Side Diff: sdk/lib/_internal/pub/test/transformer/configuration/configuration_defaults_to_empty_map_test.dart

Issue 1165473002: Start pulling pub from its own repo. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review changes Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library pub_tests;
6
7 import 'dart:convert';
8
9 import '../../descriptor.dart' as d;
10 import '../../test_pub.dart';
11 import '../../serve/utils.dart';
12
13 final transformer = """
14 import 'dart:async';
15 import 'dart:convert';
16
17 import 'package:barback/barback.dart';
18
19 class ConfigTransformer extends Transformer {
20 final BarbackSettings settings;
21
22 ConfigTransformer.asPlugin(this.settings);
23
24 String get allowedExtensions => '.txt';
25
26 Future apply(Transform transform) {
27 return transform.primaryInput.readAsString().then((contents) {
28 var id = transform.primaryInput.id.changeExtension(".json");
29 transform.addOutput(
30 new Asset.fromString(id, JSON.encode(settings.configuration)));
31 });
32 }
33 }
34 """;
35
36 main() {
37 initConfig();
38 withBarbackVersions("any", () {
39 integration("configuration defaults to an empty map", () {
40 d.dir(appPath, [
41 d.pubspec({
42 "name": "myapp",
43 "transformers": ["myapp/src/transformer"]
44 }),
45 d.dir("lib", [d.dir("src", [
46 d.file("transformer.dart", transformer)
47 ])]),
48 d.dir("web", [
49 d.file("foo.txt", "foo")
50 ])
51 ]).create();
52
53 createLockFile('myapp', pkg: ['barback']);
54
55 var server = pubServe();
56 requestShouldSucceed("foo.json", JSON.encode({}));
57 endPubServe();
58 });
59 });
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698