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

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

Issue 557563002: Store the async-await compiled pub code directly in the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
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; 1 library pub_tests;
6
7 import '../descriptor.dart' as d; 2 import '../descriptor.dart' as d;
8 import '../test_pub.dart'; 3 import '../test_pub.dart';
9 import '../serve/utils.dart'; 4 import '../serve/utils.dart';
10
11 const TRANSFORMER = """ 5 const TRANSFORMER = """
12 import 'dart:async'; 6 import 'dart:async';
13 7
14 import 'package:barback/barback.dart'; 8 import 'package:barback/barback.dart';
15 9
16 class RewriteTransformer extends Transformer { 10 class RewriteTransformer extends Transformer {
17 RewriteTransformer.asPlugin(); 11 RewriteTransformer.asPlugin();
18 12
19 String get allowedExtensions => '.txt'; 13 String get allowedExtensions => '.txt';
20 14
21 Future apply(Transform transform) { 15 Future apply(Transform transform) {
22 return Future.wait([ 16 return Future.wait([
23 transform.hasInput(transform.primaryInput.id), 17 transform.hasInput(transform.primaryInput.id),
24 transform.hasInput(new AssetId('hooble', 'whatsit')) 18 transform.hasInput(new AssetId('hooble', 'whatsit'))
25 ]).then((results) { 19 ]).then((results) {
26 var id = transform.primaryInput.id.changeExtension(".out"); 20 var id = transform.primaryInput.id.changeExtension(".out");
27 var asset = new Asset.fromString(id, 21 var asset = new Asset.fromString(id,
28 "primary: \${results[0]}, secondary: \${results[1]}"); 22 "primary: \${results[0]}, secondary: \${results[1]}");
29 transform.addOutput(asset); 23 transform.addOutput(asset);
30 }); 24 });
31 } 25 }
32 } 26 }
33 """; 27 """;
34
35 main() { 28 main() {
36 initConfig(); 29 initConfig();
37 withBarbackVersions("any", () { 30 withBarbackVersions("any", () {
38 integration("a transform can use hasInput", () { 31 integration("a transform can use hasInput", () {
39 d.dir(appPath, [ 32 d.dir(appPath, [d.pubspec({
40 d.pubspec({
41 "name": "myapp", 33 "name": "myapp",
42 "transformers": ["myapp/src/transformer"] 34 "transformers": ["myapp/src/transformer"]
43 }), 35 }),
44 d.dir("lib", [d.dir("src", [ 36 d.dir("lib", [d.dir("src", [d.file("transformer.dart", TRANSFORMER)] )]),
45 d.file("transformer.dart", TRANSFORMER) 37 d.dir("web", [d.file("foo.txt", "foo")])]).create();
46 ])]),
47 d.dir("web", [
48 d.file("foo.txt", "foo")
49 ])
50 ]).create();
51
52 createLockFile('myapp', pkg: ['barback']); 38 createLockFile('myapp', pkg: ['barback']);
53
54 pubServe(); 39 pubServe();
55 requestShouldSucceed("foo.out", "primary: true, secondary: false"); 40 requestShouldSucceed("foo.out", "primary: true, secondary: false");
56 endPubServe(); 41 endPubServe();
57 }); 42 });
58 }); 43 });
59 } 44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698