| Index: sdk/lib/_internal/pub_generated/test/serve/web_socket/path_to_urls_test.dart
|
| diff --git a/sdk/lib/_internal/pub_generated/test/serve/web_socket/path_to_urls_test.dart b/sdk/lib/_internal/pub_generated/test/serve/web_socket/path_to_urls_test.dart
|
| index 5e018733636e117a68412c4dd7101d2b70cfb59f..820d5522feeef7c5ebf82d48504107b7b8aabd5b 100644
|
| --- a/sdk/lib/_internal/pub_generated/test/serve/web_socket/path_to_urls_test.dart
|
| +++ b/sdk/lib/_internal/pub_generated/test/serve/web_socket/path_to_urls_test.dart
|
| @@ -1,10 +1,18 @@
|
| +// Copyright (c) 2014, 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:path/path.dart' as p;
|
| +
|
| import '../../../lib/src/io.dart';
|
| import '../../descriptor.dart' as d;
|
| import '../../test_pub.dart';
|
| import '../utils.dart';
|
| +
|
| main() {
|
| + // TODO(rnystrom): Split into independent tests.
|
| initConfig();
|
| integration("pathToUrls converts asset ids to matching URL paths", () {
|
| d.dir(
|
| @@ -12,6 +20,7 @@ main() {
|
| [
|
| d.libPubspec("foo", "1.0.0"),
|
| d.dir("lib", [d.file("foo.dart", "foo() => null;")])]).create();
|
| +
|
| d.dir(appPath, [d.appPubspec({
|
| "foo": {
|
| "path": "../foo"
|
| @@ -19,38 +28,49 @@ main() {
|
| }),
|
| d.dir(
|
| "test",
|
| - [d.file("index.html", "<body>"), d.dir("sub", [d.file("bar.html", "bar")])]),
|
| + [d.file("index.html", "<body>"), d.dir("sub", [d.file("bar.html", "bar"),])]),
|
| d.dir("lib", [d.file("app.dart", "app() => null;")]),
|
| d.dir(
|
| "web",
|
| - [d.file("index.html", "<body>"), d.dir("sub", [d.file("bar.html", "bar")])]),
|
| + [d.file("index.html", "<body>"), d.dir("sub", [d.file("bar.html", "bar"),])]),
|
| d.dir("randomdir", [d.file("index.html", "<body>")])]).create();
|
| +
|
| pubServe(args: ["test", "web", "randomdir"], shouldGetFirst: true);
|
| +
|
| + // Paths in web/.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("web", "index.html")
|
| }, {
|
| "urls": [getServerUrl("web", "index.html")]
|
| });
|
| +
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("web", "sub", "bar.html")
|
| }, {
|
| "urls": [getServerUrl("web", "sub/bar.html")]
|
| });
|
| +
|
| + // Paths in test/.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("test", "index.html")
|
| }, {
|
| "urls": [getServerUrl("test", "index.html")]
|
| });
|
| +
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("test", "sub", "bar.html")
|
| }, {
|
| "urls": [getServerUrl("test", "sub/bar.html")]
|
| });
|
| +
|
| + // A non-default directory.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("randomdir", "index.html")
|
| }, {
|
| "urls": [getServerUrl("randomdir", "index.html")]
|
| });
|
| +
|
| + // A path in lib/.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("lib", "app.dart")
|
| }, {
|
| @@ -59,6 +79,8 @@ main() {
|
| getServerUrl("web", "packages/myapp/app.dart"),
|
| getServerUrl("randomdir", "packages/myapp/app.dart")]
|
| });
|
| +
|
| + // A path to this package in packages/.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("packages", "myapp", "app.dart")
|
| }, {
|
| @@ -67,6 +89,8 @@ main() {
|
| getServerUrl("web", "packages/myapp/app.dart"),
|
| getServerUrl("randomdir", "packages/myapp/app.dart")]
|
| });
|
| +
|
| + // A path to another package in packages/.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("packages", "foo", "foo.dart")
|
| }, {
|
| @@ -75,6 +99,8 @@ main() {
|
| getServerUrl("web", "packages/foo/foo.dart"),
|
| getServerUrl("randomdir", "packages/foo/foo.dart")]
|
| });
|
| +
|
| + // A relative path to another package's lib/ directory.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": p.join("..", "foo", "lib", "foo.dart")
|
| }, {
|
| @@ -83,6 +109,13 @@ main() {
|
| getServerUrl("web", "packages/foo/foo.dart"),
|
| getServerUrl("randomdir", "packages/foo/foo.dart")]
|
| });
|
| +
|
| + // Note: Using canonicalize here because pub gets the path to the
|
| + // entrypoint package from the working directory, which has had symlinks
|
| + // resolve. On Mac, "/tmp" is actually a symlink to "/private/tmp", so we
|
| + // need to accomodate that.
|
| +
|
| + // An absolute path to another package's lib/ directory.
|
| expectWebSocketResult("pathToUrls", {
|
| "path": canonicalize(p.join(sandboxDir, "foo", "lib", "foo.dart"))
|
| }, {
|
| @@ -91,6 +124,7 @@ main() {
|
| getServerUrl("web", "packages/foo/foo.dart"),
|
| getServerUrl("randomdir", "packages/foo/foo.dart")]
|
| });
|
| +
|
| endPubServe();
|
| });
|
| }
|
|
|