OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:scheduled_test/scheduled_test.dart'; | 5 import 'package:scheduled_test/scheduled_test.dart'; |
6 | 6 |
7 import '../descriptor.dart' as d; | 7 import '../descriptor.dart' as d; |
8 import '../serve/utils.dart'; | 8 import '../serve/utils.dart'; |
9 import '../test_pub.dart'; | 9 import '../test_pub.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 initConfig(); | 12 initConfig(); |
13 | 13 |
14 setUp(() { | 14 setUp(() { |
15 d.dir(appPath, [ | 15 d.dir( |
16 d.appPubspec(), | 16 appPath, |
17 d.dir('benchmark', [d.file('file.txt', 'benchmark')]), | 17 [ |
18 d.dir('bin', [d.file('file.txt', 'bin')]), | 18 d.appPubspec(), |
19 d.dir('example', [d.file('file.txt', 'example')]), | 19 d.dir('benchmark', [d.file('file.txt', 'benchmark')]), |
20 d.dir('test', [d.file('file.txt', 'test')]), | 20 d.dir('bin', [d.file('file.txt', 'bin')]), |
21 d.dir('web', [d.file('file.txt', 'web')]), | 21 d.dir('example', [d.file('file.txt', 'example')]), |
22 d.dir('unknown', [d.file('file.txt', 'unknown')]) | 22 d.dir('test', [d.file('file.txt', 'test')]), |
23 ]).create(); | 23 d.dir('web', [d.file('file.txt', 'web')]), |
| 24 d.dir('unknown', [d.file('file.txt', 'unknown')])]).create(); |
24 }); | 25 }); |
25 | 26 |
26 integration("build --all finds assets in default source directories", () { | 27 integration("build --all finds assets in default source directories", () { |
27 schedulePub(args: ["build", "--all"], | 28 schedulePub( |
| 29 args: ["build", "--all"], |
28 output: new RegExp(r'Built 5 files to "build".')); | 30 output: new RegExp(r'Built 5 files to "build".')); |
29 | 31 |
30 d.dir(appPath, [ | 32 d.dir( |
31 d.dir('build', [ | 33 appPath, |
32 d.dir('benchmark', [ | 34 [ |
33 d.file('file.txt', 'benchmark') | 35 d.dir( |
34 ]), | 36 'build', |
35 d.dir('bin', [ | 37 [ |
36 d.file('file.txt', 'bin') | 38 d.dir('benchmark', [d.file('file.txt', 'benchmark')]), |
37 ]), | 39 d.dir('bin', [d.file('file.txt', 'bin')]), |
38 d.dir('example', [ | 40 d.dir('example', [d.file('file.txt', 'example')]), |
39 d.file('file.txt', 'example') | 41 d.dir('test', [d.file('file.txt', 'test')]), |
40 ]), | 42 d.dir('web', [d.file('file.txt', 'web')]), |
41 d.dir('test', [ | 43 // Only includes default source directories. |
42 d.file('file.txt', 'test') | 44 d.nothing('unknown')])]).validate(); |
43 ]), | |
44 d.dir('web', [ | |
45 d.file('file.txt', 'web') | |
46 ]), | |
47 // Only includes default source directories. | |
48 d.nothing('unknown') | |
49 ]) | |
50 ]).validate(); | |
51 }); | 45 }); |
52 | 46 |
53 integration("serve --all finds assets in default source directories", () { | 47 integration("serve --all finds assets in default source directories", () { |
54 pubServe(args: ["--all"]); | 48 pubServe(args: ["--all"]); |
55 | 49 |
56 requestShouldSucceed("file.txt", "benchmark", root: "benchmark"); | 50 requestShouldSucceed("file.txt", "benchmark", root: "benchmark"); |
57 requestShouldSucceed("file.txt", "bin", root: "bin"); | 51 requestShouldSucceed("file.txt", "bin", root: "bin"); |
58 requestShouldSucceed("file.txt", "example", root: "example"); | 52 requestShouldSucceed("file.txt", "example", root: "example"); |
59 requestShouldSucceed("file.txt", "test", root: "test"); | 53 requestShouldSucceed("file.txt", "test", root: "test"); |
60 requestShouldSucceed("file.txt", "web", root: "web"); | 54 requestShouldSucceed("file.txt", "web", root: "web"); |
61 | 55 |
62 expectNotServed("unknown"); | 56 expectNotServed("unknown"); |
63 | 57 |
64 endPubServe(); | 58 endPubServe(); |
65 }); | 59 }); |
66 } | 60 } |
OLD | NEW |