OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2013, 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 | 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 library pub_tests; | 5 library pub_tests; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
11 import 'package:scheduled_test/scheduled_test.dart'; | 11 import 'package:scheduled_test/scheduled_test.dart'; |
12 | 12 |
13 import '../descriptor.dart' as d; | 13 import '../descriptor.dart' as d; |
14 import '../test_pub.dart'; | 14 import '../test_pub.dart'; |
15 import 'utils.dart'; | 15 import 'utils.dart'; |
16 | 16 |
17 main() { | 17 main() { |
18 // This is a regression test for http://dartbug.com/21402. | 18 // This is a regression test for http://dartbug.com/21402. |
19 initConfig(); | 19 initConfig(); |
20 withBarbackVersions("any", () { | 20 withBarbackVersions("any", () { |
21 integration("picks up files replaced after serving started when using the " | 21 integration( |
22 "native watcher", () { | 22 "picks up files replaced after serving started when using the " |
23 d.dir(appPath, [ | 23 "native watcher", |
24 d.pubspec({ | 24 () { |
| 25 d.dir(appPath, [d.pubspec({ |
25 "name": "myapp", | 26 "name": "myapp", |
26 "transformers": ["myapp/src/transformer"] | 27 "transformers": ["myapp/src/transformer"] |
27 }), | 28 }), |
28 d.dir("lib", [d.dir("src", [ | 29 d.dir("lib", [d.dir("src", [d.file("transformer.dart", REWRITE_TRANS
FORMER)])]), |
29 d.file("transformer.dart", REWRITE_TRANSFORMER) | 30 d.dir("web", [d.file("file.txt", "before"),]), |
30 ])]), | 31 d.file("other", "after")]).create(); |
31 d.dir("web", [ | |
32 d.file("file.txt", "before"), | |
33 ]), | |
34 d.file("other", "after") | |
35 ]).create(); | |
36 | 32 |
37 createLockFile("myapp", pkg: ["barback"]); | 33 createLockFile("myapp", pkg: ["barback"]); |
38 | 34 |
39 pubServe(args: ["--no-force-poll"]); | 35 pubServe(args: ["--no-force-poll"]); |
40 waitForBuildSuccess(); | 36 waitForBuildSuccess(); |
41 requestShouldSucceed("file.out", "before.out"); | 37 requestShouldSucceed("file.out", "before.out"); |
42 | 38 |
43 schedule(() { | 39 schedule(() { |
44 // Replace file.txt by renaming other on top of it. | 40 // Replace file.txt by renaming other on top of it. |
45 return new File(p.join(sandboxDir, appPath, "other")) | 41 return new File( |
46 .rename(p.join(sandboxDir, appPath, "web", "file.txt")); | 42 p.join( |
| 43 sandboxDir, |
| 44 appPath, |
| 45 "other")).rename(p.join(sandboxDir, appPath, "web", "file.txt"))
; |
47 }); | 46 }); |
48 | 47 |
49 // Read the transformed file to ensure the change is actually noticed by | 48 // Read the transformed file to ensure the change is actually noticed by |
50 // pub and not that we just get the new file contents piped through | 49 // pub and not that we just get the new file contents piped through |
51 // without pub realizing they've changed. | 50 // without pub realizing they've changed. |
52 waitForBuildSuccess(); | 51 waitForBuildSuccess(); |
53 requestShouldSucceed("file.out", "after.out"); | 52 requestShouldSucceed("file.out", "after.out"); |
54 | 53 |
55 endPubServe(); | 54 endPubServe(); |
56 }); | 55 }); |
57 }); | 56 }); |
58 } | 57 } |
OLD | NEW |