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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/transformer/exclusion/works_on_aggregate_transformer_test.dart

Issue 896623005: Use native async/await support in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, 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 '../../descriptor.dart' as d;
8 import '../../test_pub.dart';
9 import '../../serve/utils.dart';
10
11 const AGGREGATE_TRANSFORMER = """
12 import 'dart:async';
13
14 import 'package:barback/barback.dart';
15 import 'package:path/path.dart' as p;
16
17 class ManyToOneTransformer extends AggregateTransformer {
18 ManyToOneTransformer.asPlugin();
19
20 String classifyPrimary(AssetId id) {
21 if (id.extension != '.txt') return null;
22 return p.url.dirname(id.path);
23 }
24
25 Future apply(AggregateTransform transform) {
26 return transform.primaryInputs.toList().then((assets) {
27 assets.sort((asset1, asset2) => asset1.id.path.compareTo(asset2.id.path));
28 return Future.wait(assets.map((asset) => asset.readAsString()));
29 }).then((contents) {
30 var id = new AssetId(transform.package,
31 p.url.join(transform.key, 'out.txt'));
32 transform.addOutput(new Asset.fromString(id, contents.join('\\n')));
33 });
34 }
35 }
36 """;
37
38 main() {
39 initConfig();
40 withBarbackVersions(">=0.14.1", () {
41 integration("works on an aggregate transformer", () {
42 d.dir(appPath, [d.pubspec({
43 "name": "myapp",
44 "transformers": [{
45 "myapp": {
46 "\$include": ["web/a.txt", "web/b.txt", "web/c.txt"],
47 "\$exclude": "web/a.txt"
48 }
49 }]
50 }),
51 d.dir("lib", [d.file("transformer.dart", AGGREGATE_TRANSFORMER),]),
52 d.dir(
53 "web",
54 [
55 d.file("a.txt", "a"),
56 d.file("b.txt", "b"),
57 d.file("c.txt", "c"),
58 d.file("d.txt", "d")])]).create();
59
60 createLockFile('myapp', pkg: ['barback']);
61
62 pubServe();
63 requestShouldSucceed("out.txt", "b\nc");
64 endPubServe();
65 });
66 });
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698