OLD | NEW |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'package:scheduled_test/scheduled_test.dart'; | 1 import 'package:scheduled_test/scheduled_test.dart'; |
6 | |
7 import '../descriptor.dart' as d; | 2 import '../descriptor.dart' as d; |
8 import '../test_pub.dart'; | 3 import '../test_pub.dart'; |
9 import '../serve/utils.dart'; | 4 import '../serve/utils.dart'; |
10 | |
11 main() { | 5 main() { |
12 initConfig(); | 6 initConfig(); |
13 integration("passes along environment constants", () { | 7 integration("passes along environment constants", () { |
14 d.dir(appPath, [ | 8 d.dir(appPath, [d.pubspec({ |
15 d.pubspec({ | |
16 "name": "myapp", | 9 "name": "myapp", |
17 "transformers": [{ | 10 "transformers": [{ |
18 "\$dart2js": {"environment": {'CONSTANT': 'true'}} | 11 "\$dart2js": { |
19 }] | 12 "environment": { |
20 }), | 13 'CONSTANT': 'true' |
21 d.dir("web", [ | 14 } |
22 d.file("main.dart", """ | 15 } |
| 16 }] |
| 17 }), d.dir("web", [d.file("main.dart", """ |
23 void main() { | 18 void main() { |
24 if (const bool.fromEnvironment('CONSTANT')) { | 19 if (const bool.fromEnvironment('CONSTANT')) { |
25 print("hello"); | 20 print("hello"); |
26 } | 21 } |
27 } | 22 } |
28 """) | 23 """)])]).create(); |
29 ]) | |
30 ]).create(); | |
31 | |
32 pubServe(); | 24 pubServe(); |
33 requestShouldSucceed("main.dart.js", contains("hello")); | 25 requestShouldSucceed("main.dart.js", contains("hello")); |
34 endPubServe(); | 26 endPubServe(); |
35 }); | 27 }); |
36 } | 28 } |
OLD | NEW |