| Index: sdk/lib/_internal/pub_generated/test/transformer/can_log_messages_test.dart
|
| diff --git a/sdk/lib/_internal/pub/test/transformer/can_log_messages_test.dart b/sdk/lib/_internal/pub_generated/test/transformer/can_log_messages_test.dart
|
| similarity index 71%
|
| copy from sdk/lib/_internal/pub/test/transformer/can_log_messages_test.dart
|
| copy to sdk/lib/_internal/pub_generated/test/transformer/can_log_messages_test.dart
|
| index da82d5dd4dcc9ea6cd02c49740a091aacf6d6032..43f304220a7cbc48af8ca6d35fbd90acd64d7029 100644
|
| --- a/sdk/lib/_internal/pub/test/transformer/can_log_messages_test.dart
|
| +++ b/sdk/lib/_internal/pub_generated/test/transformer/can_log_messages_test.dart
|
| @@ -1,16 +1,9 @@
|
| -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file
|
| -// for details. All rights reserved. Use of this source code is governed by a
|
| -// BSD-style license that can be found in the LICENSE file.
|
| -
|
| library pub_tests;
|
| -
|
| import 'package:scheduled_test/scheduled_test.dart';
|
| import 'package:scheduled_test/scheduled_stream.dart';
|
| -
|
| import '../../lib/src/exit_codes.dart' as exit_codes;
|
| import '../descriptor.dart' as d;
|
| import '../test_pub.dart';
|
| -
|
| const SOURCE_MAPS_TRANSFORMER = """
|
| import 'dart:async';
|
|
|
| @@ -37,7 +30,6 @@ class RewriteTransformer extends Transformer {
|
| }
|
| }
|
| """;
|
| -
|
| const SOURCE_SPAN_TRANSFORMER = """
|
| import 'dart:async';
|
|
|
| @@ -63,62 +55,40 @@ class RewriteTransformer extends Transformer {
|
| }
|
| }
|
| """;
|
| -
|
| main() {
|
| initConfig();
|
| - // This intentionally tests barback 0.14.2 with both transformers, since it
|
| - // supports both types of span.
|
| withBarbackVersions("<0.15.0", () => runTest(SOURCE_MAPS_TRANSFORMER));
|
| withBarbackVersions(">=0.14.2", () => runTest(SOURCE_SPAN_TRANSFORMER));
|
| }
|
| -
|
| void runTest(String transformerText) {
|
| integration("can log messages", () {
|
| - d.dir(appPath, [
|
| - d.pubspec({
|
| + d.dir(appPath, [d.pubspec({
|
| "name": "myapp",
|
| "transformers": ["myapp/src/transformer"]
|
| }),
|
| - d.dir("lib", [d.dir("src", [
|
| - d.file("transformer.dart", transformerText)
|
| - ])]),
|
| - d.dir("web", [
|
| - d.file("foo.txt", "foo")
|
| - ])
|
| - ]).create();
|
| -
|
| + d.dir("lib", [d.dir("src", [d.file("transformer.dart", transformerText)])]),
|
| + d.dir("web", [d.file("foo.txt", "foo")])]).create();
|
| createLockFile('myapp', pkg: ['barback']);
|
| -
|
| var pub = startPub(args: ["build"]);
|
| pub.stdout.expect(startsWith("Loading source assets..."));
|
| pub.stdout.expect(consumeWhile(matches("Loading .* transformers...")));
|
| pub.stdout.expect(startsWith("Building myapp..."));
|
| -
|
| pub.stdout.expect(emitsLines("""
|
| [Rewrite on myapp|web/foo.txt]:
|
| info!"""));
|
| -
|
| pub.stderr.expect(emitsLines("""
|
| [Rewrite on myapp|web/foo.txt with input myapp|web/foo.foo]:
|
| Warning!
|
| [Rewrite on myapp|web/foo.txt]:"""));
|
| -
|
| - // The details of the analyzer's error message change pretty frequently,
|
| - // so instead of validating the entire line, just look for a couple of
|
| - // salient bits of information.
|
| - pub.stderr.expect(allOf([
|
| - contains("2"), // The line number.
|
| - contains("1"), // The column number.
|
| - contains("http://fake.com/not_real.dart"), // The library.
|
| - contains("ERROR"), // That it's an error.
|
| - ]));
|
| -
|
| - // In barback >=0.15.0, the span will point to the location where the error
|
| - // occurred.
|
| + pub.stderr.expect(
|
| + allOf(
|
| + [
|
| + contains("2"),
|
| + contains("1"),
|
| + contains("http://fake.com/not_real.dart"),
|
| + contains("ERROR")]));
|
| pub.stderr.expect(allow(inOrder(["d", "^"])));
|
| -
|
| pub.stderr.expect("Build failed.");
|
| -
|
| pub.shouldExit(exit_codes.DATA);
|
| });
|
| }
|
|
|