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

Unified Diff: sdk/lib/_internal/pub/test/serve/warns_on_serve_from_asset_test.dart

Issue 228863003: Warn when serving an asset from "asset". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/barback/barback_server.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+ });
+}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/barback/barback_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698