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:convert'; | 5 import 'dart:convert'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:dart2js_info/info.dart'; | 8 import 'package:dart2js_info/info.dart'; |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 | 10 |
11 main() { | 11 main() { |
12 group('parse', () { | 12 group('parse', () { |
13 test('hello_world', () { | 13 test('hello_world', () { |
14 var helloWorld = new File('test/hello_world/hello_world.js.info.json'); | 14 var helloWorld = new File('test/hello_world/hello_world.js.info.json'); |
15 var json = JSON.decode(helloWorld.readAsStringSync()); | 15 var json = JSON.decode(helloWorld.readAsStringSync()); |
16 var decoded = new AllInfoJsonCodec().decode(json); | 16 var decoded = new AllInfoJsonCodec().decode(json); |
17 | 17 |
18 var program = decoded.program; | 18 var program = decoded.program; |
19 expect(program, isNotNull); | 19 expect(program, isNotNull); |
20 | 20 |
21 expect(program.entrypoint, isNotNull); | 21 expect(program.entrypoint, isNotNull); |
22 expect(program.size, 10124); | 22 expect(program.size, 10116); |
23 expect(program.compilationMoment, | 23 expect(program.compilationMoment, |
24 DateTime.parse("2016-09-30 16:14:58.038530")); | 24 DateTime.parse("2016-10-06 10:14:59.145665")); |
25 expect(program.compilationDuration, new Duration(microseconds: 2726976)); | 25 expect(program.compilationDuration, new Duration(microseconds: 2729236)); |
26 expect(program.toJsonDuration, new Duration(milliseconds: 4)); | 26 expect(program.toJsonDuration, new Duration(milliseconds: 4)); |
27 expect(program.dumpInfoDuration, new Duration(seconds: 0)); | 27 expect(program.dumpInfoDuration, new Duration(seconds: 0)); |
28 expect(program.noSuchMethodEnabled, false); | 28 expect(program.noSuchMethodEnabled, false); |
29 expect(program.minified, false); | 29 expect(program.minified, false); |
30 }); | 30 }); |
31 }); | 31 }); |
32 } | 32 } |
OLD | NEW |