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 '../test_pub.dart'; | 8 import '../test_pub.dart'; |
9 import '../serve/utils.dart'; | 9 import '../serve/utils.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 initConfig(); | 12 initConfig(); |
13 | 13 |
14 setUp(() { | 14 setUp(() { |
15 d.dir(appPath, [ | 15 d.dir(appPath, [ |
16 d.appPubspec(), | 16 d.appPubspec(), |
17 d.dir('asset', [d.file('file.txt', 'asset')]), | |
18 d.dir('bar', [d.file('file.txt', 'bar')]), | 17 d.dir('bar', [d.file('file.txt', 'bar')]), |
19 d.dir('foo', [d.file('file.txt', 'foo')]), | 18 d.dir('foo', [d.file('file.txt', 'foo')]), |
20 d.dir('test', [d.file('file.txt', 'test')]), | 19 d.dir('test', [d.file('file.txt', 'test')]), |
21 d.dir('web', [d.file('file.txt', 'web')]) | 20 d.dir('web', [d.file('file.txt', 'web')]) |
22 ]).create(); | 21 ]).create(); |
23 }); | 22 }); |
24 | 23 |
25 integration("builds only the given directories", () { | 24 integration("builds only the given directories", () { |
26 schedulePub(args: ["build", "foo", "bar"], | 25 schedulePub(args: ["build", "foo", "bar"], |
27 output: new RegExp(r'Built 4 files to "build".')); | 26 output: new RegExp(r'Built 2 files to "build".')); |
28 | 27 |
29 d.dir(appPath, [ | 28 d.dir(appPath, [ |
30 d.dir('build', [ | 29 d.dir('build', [ |
31 d.dir('bar', [ | 30 d.dir('bar', [ |
32 d.file('file.txt', 'bar'), | 31 d.file('file.txt', 'bar') |
33 d.dir('assets', [ | |
34 d.dir('myapp', [ | |
35 d.file('file.txt', 'asset') | |
36 ]) | |
37 ]) | |
38 ]), | 32 ]), |
39 d.dir('foo', [ | 33 d.dir('foo', [ |
40 d.file('file.txt', 'foo'), | 34 d.file('file.txt', 'foo') |
41 d.dir('assets', [ | |
42 d.dir('myapp', [ | |
43 d.file('file.txt', 'asset') | |
44 ]) | |
45 ]) | |
46 ]), | 35 ]), |
47 d.nothing('test'), | 36 d.nothing('test'), |
48 d.nothing('web') | 37 d.nothing('web') |
49 ]) | 38 ]) |
50 ]).validate(); | 39 ]).validate(); |
51 }); | 40 }); |
52 | 41 |
53 integration("serves only the given directories", () { | 42 integration("serves only the given directories", () { |
54 pubServe(args: ["foo", "bar"]); | 43 pubServe(args: ["foo", "bar"]); |
55 | 44 |
56 requestShouldSucceed("file.txt", "bar", root: "bar"); | 45 requestShouldSucceed("file.txt", "bar", root: "bar"); |
57 requestShouldSucceed("file.txt", "foo", root: "foo"); | 46 requestShouldSucceed("file.txt", "foo", root: "foo"); |
58 expectNotServed("test"); | 47 expectNotServed("test"); |
59 expectNotServed("web"); | 48 expectNotServed("web"); |
60 | 49 |
61 endPubServe(); | 50 endPubServe(); |
62 }); | 51 }); |
63 } | 52 } |
OLD | NEW |