Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: tests/compiler/dart2js/number_output_test.dart

Issue 938323003: dart2js: Better big-number shortening. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/number_output_test.dart
diff --git a/tests/compiler/dart2js/number_output_test.dart b/tests/compiler/dart2js/number_output_test.dart
index 89a99b4d6d2a4d77dfc228b8a0db5c236d814ba4..bfff386ace70612e4f560ce87c8a73bf656b00a6 100644
--- a/tests/compiler/dart2js/number_output_test.dart
+++ b/tests/compiler/dart2js/number_output_test.dart
@@ -14,20 +14,33 @@ const MEMORY_SOURCE_FILES = const {
print(double.MAX_FINITE);
}'''};
-void main() {
+void test({bool minify}) {
OutputCollector collector = new OutputCollector();
- var compiler = compilerFor(MEMORY_SOURCE_FILES, outputProvider: collector);
+ var compiler = compilerFor(MEMORY_SOURCE_FILES,
+ outputProvider: collector,
+ options: minify ? ['--minify'] : []);
asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
// Check that we use the shorter exponential representations.
String jsOutput = collector.getOutput('', 'js');
- Expect.isTrue(jsOutput.contains('1.23e+7')); // Shorter than 12300000.
- Expect.isTrue(jsOutput.contains('1.2345678901234568e+24'));
- Expect.isTrue(jsOutput.contains('1.7976931348623157e+308'));
- Expect.isFalse(jsOutput.contains('12300000'));
+ if (minify) {
+ Expect.isTrue(jsOutput.contains('123e5')); // Shorter than 12300000.
+ Expect.isTrue(jsOutput.contains('12345678901234568e8'));
+ Expect.isTrue(jsOutput.contains('17976931348623157e292'));
+ Expect.isFalse(jsOutput.contains('12300000'));
+ } else {
+ Expect.isTrue(jsOutput.contains('12300000'));
+ Expect.isTrue(jsOutput.contains('1.2345678901234568e+24'));
+ Expect.isTrue(jsOutput.contains('1.7976931348623157e+308'));
+ }
Expect.isFalse(jsOutput.contains('1234567890123456789012345'));
// The decimal expansion of double.MAX_FINITE has 308 digits. We only check
// for its prefix.
Expect.isFalse(jsOutput.contains('179769313486231570814527423731'));
}));
}
+
+main() {
+ test(minify: true);
+ test(minify: false);
+}

Powered by Google App Engine
This is Rietveld 408576698