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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/snapshot/snapshots_transformed_code_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 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 'package:path/path.dart' as p;
8 import 'package:scheduled_test/scheduled_test.dart';
9
10 import '../descriptor.dart' as d;
11 import '../test_pub.dart';
12
13 const REPLACE_TRANSFORMER = """
14 import 'dart:async';
15
16 import 'package:barback/barback.dart';
17
18 class ReplaceTransformer extends Transformer {
19 ReplaceTransformer.asPlugin();
20
21 String get allowedExtensions => '.dart';
22
23 Future apply(Transform transform) {
24 return transform.primaryInput.readAsString().then((contents) {
25 transform.addOutput(new Asset.fromString(transform.primaryInput.id,
26 contents.replaceAll("REPLACE ME", "hello!")));
27 });
28 }
29 }
30 """;
31
32 main() {
33 initConfig();
34 integration("snapshots the transformed version of an executable", () {
35 servePackages((builder) {
36 builder.serveRepoPackage('barback');
37
38 builder.serve("foo", "1.2.3", deps: {
39 "barback": "any"
40 }, pubspec: {
41 'transformers': ['foo']
42 },
43 contents: [
44 d.dir("lib", [d.file("foo.dart", REPLACE_TRANSFORMER)]),
45 d.dir("bin", [d.file("hello.dart", """
46 final message = 'REPLACE ME';
47
48 void main() => print(message);
49 """),])]);
50 });
51
52 d.appDir({
53 "foo": "1.2.3"
54 }).create();
55
56 pubGet(output: contains("Precompiled foo:hello."));
57
58 d.dir(
59 p.join(appPath, '.pub', 'bin'),
60 [
61 d.dir(
62 'foo',
63 [d.matcherFile('hello.dart.snapshot', contains('hello!'))])]).va lidate();
64
65 var process = pubRun(args: ['foo:hello']);
66 process.stdout.expect("hello!");
67 process.shouldExit();
68 });
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698