| Index: sdk/lib/_internal/pub/test/serve/warns_on_serve_from_asset_test.dart
|
| diff --git a/sdk/lib/_internal/pub/test/serve/warns_on_serve_from_asset_test.dart b/sdk/lib/_internal/pub/test/serve/warns_on_serve_from_asset_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2f4fc497cbccd8a95ad10a801745162073c7f3a5
|
| --- /dev/null
|
| +++ b/sdk/lib/_internal/pub/test/serve/warns_on_serve_from_asset_test.dart
|
| @@ -0,0 +1,56 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS 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_stream.dart';
|
| +
|
| +import '../descriptor.dart' as d;
|
| +import '../test_pub.dart';
|
| +import 'utils.dart';
|
| +
|
| +main() {
|
| + initConfig();
|
| + integration("warns if an asset from the entrypoint package's 'asset' "
|
| + "directory is requested", () {
|
| + d.dir(appPath, [
|
| + d.appPubspec(),
|
| + d.dir("asset", [
|
| + d.file("file.txt", "body")
|
| + ])
|
| + ]).create();
|
| +
|
| + var pub = pubServe();
|
| + requestShouldSucceed("assets/myapp/file.txt", "body");
|
| +
|
| + pub.stderr.expect(consumeThrough(emitsLines('''
|
| +Warning: Support for the "asset" directory is deprecated and will be removed soon.
|
| +Please move "asset/file.txt" to "lib/file.txt".''')));
|
| + endPubServe();
|
| + });
|
| +
|
| + integration("warns if an asset from a dependency's 'asset' directory is "
|
| + "requested", () {
|
| + d.dir("foo", [
|
| + d.libPubspec("foo", "0.0.1"),
|
| + d.dir("asset", [
|
| + d.file("file.txt", "body")
|
| + ])
|
| + ]).create();
|
| +
|
| + d.dir(appPath, [
|
| + d.appPubspec({
|
| + "foo": {"path": "../foo"}
|
| + })
|
| + ]).create();
|
| +
|
| + var pub = pubServe(shouldGetFirst: true);
|
| + requestShouldSucceed("assets/foo/file.txt", "body");
|
| +
|
| + pub.stderr.expect(consumeThrough(emitsLines('''
|
| +Warning: Support for the "asset" directory is deprecated and will be removed soon.
|
| +Please ask the maintainer of "foo" to move "asset/file.txt" to "lib/file.txt".''')));
|
| + endPubServe();
|
| + });
|
| +}
|
|
|