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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/run/displays_transformer_logs_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 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; 1 import '../descriptor.dart' as d;
6 import '../test_pub.dart'; 2 import '../test_pub.dart';
7
8 const SCRIPT = """ 3 const SCRIPT = """
9 import "package:myapp/lib.dart"; 4 import "package:myapp/lib.dart";
10 main() { 5 main() {
11 callLib(); 6 callLib();
12 } 7 }
13 """; 8 """;
14
15 const LIB = """ 9 const LIB = """
16 callLib() { 10 callLib() {
17 print("lib"); 11 print("lib");
18 } 12 }
19 """; 13 """;
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 = """ 14 const TRANSFORMER = """
26 import 'dart:async'; 15 import 'dart:async';
27 16
28 import 'package:barback/barback.dart'; 17 import 'package:barback/barback.dart';
29 18
30 class LoggingTransformer extends Transformer implements LazyTransformer { 19 class LoggingTransformer extends Transformer implements LazyTransformer {
31 LoggingTransformer.asPlugin(); 20 LoggingTransformer.asPlugin();
32 21
33 String get allowedExtensions => '.dart'; 22 String get allowedExtensions => '.dart';
34 23
35 void apply(Transform transform) { 24 void apply(Transform transform) {
36 transform.logger.info('\${transform.primaryInput.id}.'); 25 transform.logger.info('\${transform.primaryInput.id}.');
37 transform.logger.warning('\${transform.primaryInput.id}.'); 26 transform.logger.warning('\${transform.primaryInput.id}.');
38 } 27 }
39 28
40 void declareOutputs(DeclaringTransform transform) { 29 void declareOutputs(DeclaringTransform transform) {
41 // TODO(rnystrom): Remove this when #19408 is fixed. 30 // TODO(rnystrom): Remove this when #19408 is fixed.
42 transform.declareOutput(transform.primaryId); 31 transform.declareOutput(transform.primaryId);
43 } 32 }
44 } 33 }
45 """; 34 """;
46
47 main() { 35 main() {
48 initConfig(); 36 initConfig();
49 withBarbackVersions("any", () { 37 withBarbackVersions("any", () {
50 integration('displays transformer log messages', () { 38 integration('displays transformer log messages', () {
51 d.dir(appPath, [ 39 d.dir(appPath, [d.pubspec({
52 d.pubspec({
53 "name": "myapp", 40 "name": "myapp",
54 "transformers": ["myapp/src/transformer"] 41 "transformers": ["myapp/src/transformer"]
55 }), 42 }),
56 d.dir("lib", [ 43 d.dir(
57 d.file("lib.dart", LIB), 44 "lib",
58 d.dir("src", [ 45 [
59 d.file("transformer.dart", TRANSFORMER) 46 d.file("lib.dart", LIB),
60 ]) 47 d.dir("src", [d.file("transformer.dart", TRANSFORMER)])]),
61 ]), 48 d.dir("bin", [d.file("script.dart", SCRIPT)])]).create();
62 d.dir("bin", [
63 d.file("script.dart", SCRIPT)
64 ])
65 ]).create();
66
67 createLockFile('myapp', pkg: ['barback']); 49 createLockFile('myapp', pkg: ['barback']);
68
69 var pub = pubRun(args: ["script"]); 50 var pub = pubRun(args: ["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]:"); 51 pub.stdout.expect("[Info from Logging]:");
75 pub.stdout.expect("myapp|bin/script.dart."); 52 pub.stdout.expect("myapp|bin/script.dart.");
76
77 pub.stderr.expect("[Warning from Logging]:"); 53 pub.stderr.expect("[Warning from Logging]:");
78 pub.stderr.expect("myapp|bin/script.dart."); 54 pub.stderr.expect("myapp|bin/script.dart.");
79
80 pub.stdout.expect("[Info from Logging]:"); 55 pub.stdout.expect("[Info from Logging]:");
81 pub.stdout.expect("myapp|lib/lib.dart."); 56 pub.stdout.expect("myapp|lib/lib.dart.");
82
83 pub.stderr.expect("[Warning from Logging]:"); 57 pub.stderr.expect("[Warning from Logging]:");
84 pub.stderr.expect("myapp|lib/lib.dart."); 58 pub.stderr.expect("myapp|lib/lib.dart.");
85
86 pub.stdout.expect("lib"); 59 pub.stdout.expect("lib");
87 pub.shouldExit(); 60 pub.shouldExit();
88 }); 61 });
89 }); 62 });
90 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698