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

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

Issue 110013003: Issue 15037. Warn users if they have “assets” dir anywhere inside “web” dir (http://dartbug.com/150… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Escape "\" in RegExps. Created 7 years 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/test/build/warns_on_assets_paths_test.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_assets_paths_test.dart
diff --git a/sdk/lib/_internal/pub/test/serve/warns_on_assets_paths_test.dart b/sdk/lib/_internal/pub/test/serve/warns_on_assets_paths_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..467cf09cabeddc6ec9b90a2872253e1aedb57587
--- /dev/null
+++ b/sdk/lib/_internal/pub/test/serve/warns_on_assets_paths_test.dart
@@ -0,0 +1,113 @@
+// 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:path/path.dart' as path;
+import 'package:scheduled_test/scheduled_test.dart';
+
+import '../descriptor.dart' as d;
+import '../test_pub.dart';
+import 'utils.dart';
+
+getWarningRegExp(String assetsPath) => new RegExp(
+ '^Warning: Pub reserves paths containing "assets" for using assets from '
+ 'packages\\. Please rename the path "$assetsPath"\\.\$');
+
+main() {
+ initConfig();
+
+ integration('warns user about assets dir in the root of "web"', () {
+ d.dir(appPath, [
+ d.appPubspec(),
+ d.dir('web', [
+ d.file('index.html'),
+ d.dir('assets')
+ ])
+ ]).create();
+
+ var pub = pubServe();
+ waitForBuildSuccess();
+ endPubServe();
+
+ var assetsPath = path.join('web', 'assets');
+ expect(pub.remainingStderr(), completion(
+ matches(getWarningRegExp(assetsPath))));
+ });
+
+ integration('warns user about assets dir nested anywhere in "web"', () {
+ d.dir(appPath, [
+ d.appPubspec(),
+ d.dir('web', [
+ d.file('index.html'),
+ d.dir('foo', [
+ d.dir('assets')
+ ])
+ ])
+ ]).create();
+
+ var pub = pubServe();
+ waitForBuildSuccess();
+ endPubServe();
+
+ var assetsPath = path.join('web', 'foo', 'assets');
+ expect(pub.remainingStderr(), completion(
+ matches(getWarningRegExp(assetsPath))));
+ });
+
+ integration('warns user about assets file in the root of "web"', () {
+ d.dir(appPath, [
+ d.appPubspec(),
+ d.dir('web', [
+ d.file('index.html'),
+ d.file('assets')
+ ])
+ ]).create();
+
+ var pub = pubServe();
+ waitForBuildSuccess();
+ endPubServe();
+
+ var assetsPath = path.join('web', 'assets');
+ expect(pub.remainingStderr(), completion(
+ matches(getWarningRegExp(assetsPath))));
+ });
+
+ integration('warns user about assets file nested anywhere in "web"', () {
+ d.dir(appPath, [
+ d.appPubspec(),
+ d.dir('web', [
+ d.file('index.html'),
+ d.dir('foo', [
+ d.file('assets')
+ ])
+ ])
+ ]).create();
+
+ var pub = pubServe();
+ waitForBuildSuccess();
+ endPubServe();
+
+ var assetsPath = path.join('web', 'foo', 'assets');
+ expect(pub.remainingStderr(), completion(
+ matches(getWarningRegExp(assetsPath))));
+ });
+
+ integration('does not warn if no assets dir or file anywhere in "web"', () {
+ d.dir(appPath, [
+ d.appPubspec(),
+ d.dir('web', [
+ d.file('index.html'),
+ d.dir('foo')
+ ])
+ ]).create();
+
+ var pub = pubServe();
+ waitForBuildSuccess();
+ endPubServe();
+
+ expect(pub.remainingStderr(), completion(
+ matches(r'^(?!Warning: Pub reserves paths containing "assets").*$')));
+ });
+}
« no previous file with comments | « sdk/lib/_internal/pub/test/build/warns_on_assets_paths_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698