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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/run/displays_transformer_logs_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 import '../descriptor.dart' as d;
6 import '../test_pub.dart';
7
8 const SCRIPT = """
9 import "package:myapp/lib.dart";
10 main() {
11 callLib();
12 }
13 """;
14
15 const LIB = """
16 callLib() {
17 print("lib");
18 }
19 """;
20
21 // Make it lazy so that "lib.dart" isn't transformed until after the process
22 // is started. Otherwise, since this tranformer modifies .dart files, it will
23 // be run while the transformers themselves are loading during pub run's
24 // startup.
25 const TRANSFORMER = """
26 import 'dart:async';
27
28 import 'package:barback/barback.dart';
29
30 class LoggingTransformer extends Transformer implements LazyTransformer {
31 LoggingTransformer.asPlugin();
32
33 String get allowedExtensions => '.dart';
34
35 void apply(Transform transform) {
36 transform.logger.info('\${transform.primaryInput.id}.');
37 transform.logger.warning('\${transform.primaryInput.id}.');
38 }
39
40 void declareOutputs(DeclaringTransform transform) {
41 // TODO(rnystrom): Remove this when #19408 is fixed.
42 transform.declareOutput(transform.primaryId);
43 }
44 }
45 """;
46
47 main() {
48 initConfig();
49 withBarbackVersions("any", () {
50 integration('displays transformer log messages', () {
51 d.dir(appPath, [d.pubspec({
52 "name": "myapp",
53 "transformers": ["myapp/src/transformer"]
54 }),
55 d.dir(
56 "lib",
57 [
58 d.file("lib.dart", LIB),
59 d.dir("src", [d.file("transformer.dart", TRANSFORMER)])]),
60 d.dir("bin", [d.file("script.dart", SCRIPT)])]).create();
61
62 createLockFile('myapp', pkg: ['barback']);
63
64 var pub = pubRun(args: ["script"]);
65
66 // Note that the info log is only displayed here because the test
67 // harness runs pub in verbose mode. By default, only the warning would
68 // be shown.
69 pub.stdout.expect("[Info from Logging]:");
70 pub.stdout.expect("myapp|bin/script.dart.");
71
72 pub.stderr.expect("[Warning from Logging]:");
73 pub.stderr.expect("myapp|bin/script.dart.");
74
75 pub.stdout.expect("[Info from Logging]:");
76 pub.stdout.expect("myapp|lib/lib.dart.");
77
78 pub.stderr.expect("[Warning from Logging]:");
79 pub.stderr.expect("myapp|lib/lib.dart.");
80
81 pub.stdout.expect("lib");
82 pub.shouldExit();
83 });
84 });
85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698