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'; |
| 6 import 'dart:io'; |
| 7 |
5 import 'package:dart2js_info/info.dart'; | 8 import 'package:dart2js_info/info.dart'; |
6 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
7 | 10 |
8 main() { | 11 main() { |
9 group('parse', () { | 12 group('parse', () { |
10 test('empty', () { | 13 test('hello_world', () { |
11 var json = { | 14 var helloWorld = new File('test/hello_world/hello_world.js.info.json'); |
12 'elements': { | 15 var json = JSON.decode(helloWorld.readAsStringSync()); |
13 'library': {}, | 16 var decoded = new AllInfoJsonCodec().decode(json); |
14 'class': {}, | |
15 'function': {}, | |
16 'field': {}, | |
17 'typedef': {}, | |
18 }, | |
19 'holding': {}, | |
20 'program': {'size': 10}, | |
21 'outputUnits': [], | |
22 }; | |
23 | 17 |
24 expect(new AllInfoJsonCodec().decode(json).program.size, 10); | 18 var program = decoded.program; |
25 }); | 19 expect(program, isNotNull); |
| 20 |
| 21 expect(program.entrypoint, isNotNull); |
| 22 expect(program.size, 10124); |
| 23 expect(program.compilationMoment, |
| 24 DateTime.parse("2016-09-30 13:44:11.847439")); |
| 25 expect(program.compilationDuration, |
| 26 new Duration(seconds: 3, microseconds: 717112)); |
| 27 expect(program.noSuchMethodEnabled, false); |
| 28 expect(program.minified, false); |
| 29 }, skip: "need to update dart2js first"); |
26 }); | 30 }); |
27 } | 31 } |
OLD | NEW |