OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
8 import 'memory_compiler.dart'; | 8 import 'memory_compiler.dart'; |
9 | 9 |
10 const MEMORY_SOURCE_FILES = const { | 10 const MEMORY_SOURCE_FILES = const { |
11 'main.dart': ''' | 11 'main.dart': ''' |
12 main() { | 12 main() { |
13 print(12300000); | 13 print(12300000); |
14 print(1234567890123456789012345); | 14 print(1234567890123456789012345); |
15 print(double.MAX_FINITE); | 15 print(double.MAX_FINITE); |
16 print(-22230000); | 16 print(-22230000); |
17 }'''}; | 17 }''' |
| 18 }; |
18 | 19 |
19 Future test({bool minify}) async { | 20 Future test({bool minify}) async { |
20 OutputCollector collector = new OutputCollector(); | 21 OutputCollector collector = new OutputCollector(); |
21 await runCompiler( | 22 await runCompiler( |
22 memorySourceFiles: MEMORY_SOURCE_FILES, | 23 memorySourceFiles: MEMORY_SOURCE_FILES, |
23 outputProvider: collector, | 24 outputProvider: collector, |
24 options: minify ? ['--minify'] : []); | 25 options: minify ? ['--minify'] : []); |
25 | 26 |
26 // Check that we use the shorter exponential representations. | 27 // Check that we use the shorter exponential representations. |
27 String jsOutput = collector.getOutput('', 'js'); | 28 String jsOutput = collector.getOutput('', 'js'); |
(...skipping 15 matching lines...) Expand all Loading... |
43 // for its prefix. | 44 // for its prefix. |
44 Expect.isFalse(jsOutput.contains('179769313486231570814527423731')); | 45 Expect.isFalse(jsOutput.contains('179769313486231570814527423731')); |
45 } | 46 } |
46 | 47 |
47 main() { | 48 main() { |
48 asyncTest(() async { | 49 asyncTest(() async { |
49 await test(minify: true); | 50 await test(minify: true); |
50 await test(minify: false); | 51 await test(minify: false); |
51 }); | 52 }); |
52 } | 53 } |
OLD | NEW |