| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
| 9 | 9 |
| 10 import '../descriptor.dart' as d; | 10 import '../descriptor.dart' as d; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 pubGet(); | 88 pubGet(); |
| 89 var pub = pubRun(args: ["bin/script"]); | 89 var pub = pubRun(args: ["bin/script"]); |
| 90 | 90 |
| 91 // TODO(nweiz): Enable this when sdk#23990 is fixed. | 91 // TODO(nweiz): Enable this when sdk#23990 is fixed. |
| 92 // pub.stdout.expect(p.toUri(p.join(sandboxDir, "foo/lib/resource.txt"))); | 92 // pub.stdout.expect(p.toUri(p.join(sandboxDir, "foo/lib/resource.txt"))); |
| 93 | 93 |
| 94 pub.stdout.expect("hello!"); | 94 pub.stdout.expect("hello!"); |
| 95 pub.shouldExit(0); | 95 pub.shouldExit(0); |
| 96 }); | 96 }); |
| 97 | 97 |
| 98 withBarbackVersions("any", () { | 98 integration('the spawned application can load a transformed resource', () { |
| 99 integration('the spawned application can load a transformed resource', () { | 99 d.dir(appPath, [ |
| 100 d.dir(appPath, [ | 100 d.pubspec({ |
| 101 d.pubspec({ | 101 "name": "myapp", |
| 102 "name": "myapp", | 102 "transformers": ["myapp/src/transformer"] |
| 103 "transformers": ["myapp/src/transformer"] | 103 }), |
| 104 }), | 104 d.dir("lib", [ |
| 105 d.dir("lib", [ | 105 d.file("resource.in", "hello!"), |
| 106 d.file("resource.in", "hello!"), | 106 d.dir("src", [ |
| 107 d.dir("src", [ | 107 d.file("transformer.dart", TRANSFORMER) |
| 108 d.file("transformer.dart", TRANSFORMER) | 108 ]) |
| 109 ]) | 109 ]), |
| 110 ]), | 110 d.dir("bin", [ |
| 111 d.dir("bin", [ | 111 d.file("script.dart", """ |
| 112 d.file("script.dart", """ | |
| 113 main() async { | 112 main() async { |
| 114 var resource = new Resource("package:myapp/resource.txt"); | 113 var resource = new Resource("package:myapp/resource.txt"); |
| 115 | 114 |
| 116 // TODO(nweiz): Enable this when sdk#23990 is fixed. | 115 // TODO(nweiz): Enable this when sdk#23990 is fixed. |
| 117 // print(resource.uri); | 116 // print(resource.uri); |
| 118 | 117 |
| 119 print(await resource.readAsString()); | 118 print(await resource.readAsString()); |
| 120 } | 119 } |
| 121 """) | 120 """) |
| 122 ]) | 121 ]) |
| 123 ]).create(); | 122 ]).create(); |
| 124 | 123 |
| 125 createLockFile('myapp', pkg: ['barback']); | 124 createLockFile('myapp', pkg: ['barback']); |
| 126 | 125 |
| 127 var pub = pubRun(args: ["bin/script"]); | 126 var pub = pubRun(args: ["bin/script"]); |
| 128 | 127 |
| 129 // TODO(nweiz): Enable this when sdk#23990 is fixed. | 128 // TODO(nweiz): Enable this when sdk#23990 is fixed. |
| 130 // pub.stdout.expect(p.toUri(p.join(sandboxDir, "myapp/lib/resource.txt"))
); | 129 // pub.stdout.expect(p.toUri(p.join(sandboxDir, "myapp/lib/resource.txt"))); |
| 131 | 130 |
| 132 pub.stdout.expect("hello!"); | 131 pub.stdout.expect("hello!"); |
| 133 pub.shouldExit(0); | 132 pub.shouldExit(0); |
| 134 }); | |
| 135 }); | 133 }); |
| 136 | 134 |
| 137 integration('a snapshotted application can load a resource', () { | 135 integration('a snapshotted application can load a resource', () { |
| 138 servePackages((builder) { | 136 servePackages((builder) { |
| 139 builder.serve("foo", "1.0.0", contents: [ | 137 builder.serve("foo", "1.0.0", contents: [ |
| 140 d.dir("lib", [ | 138 d.dir("lib", [ |
| 141 d.file("resource.txt", "hello!") | 139 d.file("resource.txt", "hello!") |
| 142 ]), | 140 ]), |
| 143 d.dir("bin", [ | 141 d.dir("bin", [ |
| 144 d.file("script.dart", """ | 142 d.file("script.dart", """ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 165 | 163 |
| 166 var pub = pubRun(args: ["foo:script"]); | 164 var pub = pubRun(args: ["foo:script"]); |
| 167 | 165 |
| 168 // TODO(nweiz): Enable this when sdk#23990 is fixed. | 166 // TODO(nweiz): Enable this when sdk#23990 is fixed. |
| 169 // pub.stdout.expect(p.toUri(p.join(sandboxDir, "foo/lib/resource.txt"))); | 167 // pub.stdout.expect(p.toUri(p.join(sandboxDir, "foo/lib/resource.txt"))); |
| 170 | 168 |
| 171 pub.stdout.expect("hello!"); | 169 pub.stdout.expect("hello!"); |
| 172 pub.shouldExit(0); | 170 pub.shouldExit(0); |
| 173 }); | 171 }); |
| 174 } | 172 } |
| OLD | NEW |