OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS 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 file. |
| 4 |
1 import 'package:path/path.dart' as p; | 5 import 'package:path/path.dart' as p; |
2 import 'package:scheduled_test/scheduled_test.dart'; | 6 import 'package:scheduled_test/scheduled_test.dart'; |
| 7 |
3 import '../descriptor.dart' as d; | 8 import '../descriptor.dart' as d; |
4 import '../serve/utils.dart'; | 9 import '../serve/utils.dart'; |
5 import '../test_pub.dart'; | 10 import '../test_pub.dart'; |
| 11 |
6 main() { | 12 main() { |
7 initConfig(); | 13 initConfig(); |
| 14 |
8 setUp(() { | 15 setUp(() { |
9 d.dir( | 16 d.dir( |
10 appPath, | 17 appPath, |
11 [ | 18 [ |
12 d.appPubspec(), | 19 d.appPubspec(), |
13 d.dir( | 20 d.dir( |
14 "web", | 21 "web", |
15 [ | 22 [ |
16 d.dir("one", [d.dir("inner", [d.file("file.txt", "one")])]), | 23 d.dir("one", [d.dir("inner", [d.file("file.txt", "one")])]), |
17 d.dir("two", [d.dir("inner", [d.file("file.txt", "two")])]), | 24 d.dir("two", [d.dir("inner", [d.file("file.txt", "two")])]), |
18 d.dir("nope", [d.dir("inner", [d.file("file.txt", "nope")])]
)])]).create(); | 25 d.dir("nope", [d.dir("inner", [d.file("file.txt", "nope")])]
)])]).create(); |
19 }); | 26 }); |
| 27 |
20 var webOne = p.join("web", "one"); | 28 var webOne = p.join("web", "one"); |
21 var webTwoInner = p.join("web", "two", "inner"); | 29 var webTwoInner = p.join("web", "two", "inner"); |
| 30 |
22 integration("builds subdirectories", () { | 31 integration("builds subdirectories", () { |
23 schedulePub( | 32 schedulePub( |
24 args: ["build", webOne, webTwoInner], | 33 args: ["build", webOne, webTwoInner], |
25 output: new RegExp(r'Built 2 files to "build".')); | 34 output: new RegExp(r'Built 2 files to "build".')); |
| 35 |
26 d.dir( | 36 d.dir( |
27 appPath, | 37 appPath, |
28 [ | 38 [ |
29 d.dir( | 39 d.dir( |
30 "build", | 40 "build", |
31 [ | 41 [ |
32 d.dir( | 42 d.dir( |
33 "web", | 43 "web", |
34 [ | 44 [ |
35 d.dir("one", [d.dir("inner", [d.file("file.txt", "on
e")])]), | 45 d.dir("one", [d.dir("inner", [d.file("file.txt", "on
e")])]), |
36 d.dir("two", [d.dir("inner", [d.file("file.txt", "tw
o")])]), | 46 d.dir("two", [d.dir("inner", [d.file("file.txt", "tw
o")])]), |
37 d.nothing("nope")])])]).validate(); | 47 d.nothing("nope")])])]).validate(); |
38 }); | 48 }); |
| 49 |
39 integration("serves subdirectories", () { | 50 integration("serves subdirectories", () { |
40 pubServe(args: [webOne, webTwoInner]); | 51 pubServe(args: [webOne, webTwoInner]); |
| 52 |
41 requestShouldSucceed("inner/file.txt", "one", root: webOne); | 53 requestShouldSucceed("inner/file.txt", "one", root: webOne); |
42 requestShouldSucceed("file.txt", "two", root: webTwoInner); | 54 requestShouldSucceed("file.txt", "two", root: webTwoInner); |
43 expectNotServed("web"); | 55 expectNotServed("web"); |
44 expectNotServed(p.join("web", "three")); | 56 expectNotServed(p.join("web", "three")); |
| 57 |
45 endPubServe(); | 58 endPubServe(); |
46 }); | 59 }); |
47 } | 60 } |
OLD | NEW |