Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS d.file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE d.file. | |
| 4 | |
| 5 library pub_tests; | |
| 6 | |
| 7 import 'dart:io'; | |
| 8 | |
| 9 import '../descriptor.dart' as d; | |
| 10 import '../test_pub.dart'; | |
| 11 import 'utils.dart'; | |
| 12 | |
| 13 main() { | |
| 14 initConfig(); | |
| 15 integration("finds files in the app's web directory", () { | |
| 16 d.dir(appPath, [ | |
| 17 d.appPubspec(), | |
| 18 d.dir("web", [ | |
| 19 d.file("index.html", "<body>"), | |
| 20 d.file("file.dart", "void main() => print('hello');"), | |
| 21 d.dir("sub", [ | |
| 22 d.file("file.html", "<body>in subdir</body>"), | |
| 23 d.file("lib.dart", "void foo() => 'foo';"), | |
| 24 ]) | |
| 25 ]) | |
| 26 ]).create(); | |
| 27 | |
| 28 startPubServe(); | |
| 29 requestShouldSucceed("index.html", "<body>"); | |
| 30 requestShouldSucceed("file.dart", "void main() => print('hello');"); | |
| 31 requestShouldSucceed("sub/file.html", "<body>in subdir</body>"); | |
| 32 requestShouldSucceed("sub/lib.dart", "void foo() => 'foo';"); | |
| 33 endPubServe(); | |
| 34 }); | |
| 35 | |
| 36 integration("'packages' URLs look in the app's lib directory", () { | |
|
nweiz
2013/07/25 22:58:58
I thought we were on a strict one-test-per-file di
Bob Nystrom
2013/07/26 20:20:11
Done.
| |
| 37 d.dir(appPath, [ | |
| 38 d.appPubspec(), | |
| 39 d.dir("lib", [ | |
| 40 d.file("lib.dart", "foo() => 'foo';"), | |
| 41 d.dir("sub", [ | |
| 42 d.file("lib.dart", "bar() => 'bar';"), | |
| 43 ]) | |
| 44 ]) | |
| 45 ]).create(); | |
| 46 | |
| 47 startPubServe(); | |
| 48 requestShouldSucceed("packages/myapp/lib.dart", "foo() => 'foo';"); | |
| 49 requestShouldSucceed("packages/myapp/sub/lib.dart", "bar() => 'bar';"); | |
| 50 | |
| 51 // "packages" can be in a subpath of the URL: | |
| 52 requestShouldSucceed("foo/packages/myapp/lib.dart", "foo() => 'foo';"); | |
| 53 requestShouldSucceed("a/b/packages/myapp/sub/lib.dart", "bar() => 'bar';"); | |
| 54 endPubServe(); | |
| 55 }); | |
| 56 | |
| 57 integration("'assets' URLs look in the app's 'asset' directory", () { | |
| 58 d.dir(appPath, [ | |
| 59 d.appPubspec(), | |
| 60 d.dir("asset", [ | |
| 61 d.file("foo.txt", "foo"), | |
| 62 d.dir("sub", [ | |
| 63 d.file("bar.txt", "bar"), | |
| 64 ]) | |
| 65 ]) | |
| 66 ]).create(); | |
| 67 | |
| 68 startPubServe(); | |
| 69 requestShouldSucceed("assets/myapp/foo.txt", "foo"); | |
| 70 requestShouldSucceed("assets/myapp/sub/bar.txt", "bar"); | |
| 71 | |
| 72 // "assets" can be in a subpath of the URL: | |
| 73 requestShouldSucceed("foo/assets/myapp/foo.txt", "foo"); | |
| 74 requestShouldSucceed("a/b/assets/myapp/sub/bar.txt", "bar"); | |
| 75 endPubServe(); | |
| 76 }); | |
| 77 | |
| 78 integration("requesting '/' reads 'web/index.html'", () { | |
| 79 d.dir(appPath, [ | |
| 80 d.appPubspec(), | |
| 81 d.dir("web", [ | |
| 82 d.file("index.html", "<body>") | |
| 83 ]) | |
| 84 ]).create(); | |
| 85 | |
| 86 startPubServe(); | |
| 87 requestShouldSucceed("", "<body>"); | |
| 88 endPubServe(); | |
| 89 }); | |
| 90 } | |
| OLD | NEW |