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

Side by Side Diff: sdk/lib/_internal/pub/test/run/displays_transformer_logs_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) 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, [
52 d.pubspec({
53 "name": "myapp",
54 "transformers": ["myapp/src/transformer"]
55 }),
56 d.dir("lib", [
57 d.file("lib.dart", LIB),
58 d.dir("src", [
59 d.file("transformer.dart", TRANSFORMER)
60 ])
61 ]),
62 d.dir("bin", [
63 d.file("script.dart", SCRIPT)
64 ])
65 ]).create();
66
67 createLockFile('myapp', pkg: ['barback']);
68
69 var pub = pubRun(args: ["bin/script"]);
70
71 // Note that the info log is only displayed here because the test
72 // harness runs pub in verbose mode. By default, only the warning would
73 // be shown.
74 pub.stdout.expect("[Info from Logging]:");
75 pub.stdout.expect("myapp|bin/script.dart.");
76
77 pub.stderr.expect("[Warning from Logging]:");
78 pub.stderr.expect("myapp|bin/script.dart.");
79
80 pub.stdout.expect("[Info from Logging]:");
81 pub.stdout.expect("myapp|lib/lib.dart.");
82
83 pub.stderr.expect("[Warning from Logging]:");
84 pub.stderr.expect("myapp|lib/lib.dart.");
85
86 pub.stdout.expect("lib");
87 pub.shouldExit();
88 });
89 });
90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698