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 /// Tests for summary reporting. | 5 /// Tests for summary reporting. |
6 library dev_compiler.test.report_test; | 6 library dev_compiler.test.report_test; |
7 | 7 |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 | 9 |
10 import 'package:dev_compiler/src/testing.dart'; | 10 import 'package:dev_compiler/src/testing.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 '/main.dart': ''' | 21 '/main.dart': ''' |
22 import 'package:foo/bar.dart'; | 22 import 'package:foo/bar.dart'; |
23 | 23 |
24 test1() { | 24 test1() { |
25 x = /*severe:StaticTypeError*/"hi"; | 25 x = /*severe:StaticTypeError*/"hi"; |
26 } | 26 } |
27 ''', | 27 ''', |
28 'package:foo/bar.dart': ''' | 28 'package:foo/bar.dart': ''' |
29 num x; | 29 num x; |
30 test2() { | 30 test2() { |
31 int y = /*info:DownCast*/x; | 31 int y = /*info:AssignmentCast*/x; |
32 } | 32 } |
33 ''', | 33 ''', |
34 }; | 34 }; |
35 testChecker(files); | 35 testChecker(files); |
36 var reporter = new SummaryReporter(); | 36 var reporter = new SummaryReporter(); |
37 testChecker(files, reporter: reporter); | 37 testChecker(files, reporter: reporter); |
38 | 38 |
39 var summary1 = reporter.result; | 39 var summary1 = reporter.result; |
40 expect(summary1.loose['file:///main.dart'].messages.length, 1); | 40 expect(summary1.loose['file:///main.dart'].messages.length, 1); |
41 var barUrl = 'package:foo/bar.dart'; | 41 var barUrl = 'package:foo/bar.dart'; |
42 expect(summary1.packages['foo'].libraries[barUrl].messages.length, 1); | 42 expect(summary1.packages['foo'].libraries[barUrl].messages.length, 1); |
43 | 43 |
44 var summary2 = GlobalSummary.parse(summary1.toJsonMap()); | 44 var summary2 = GlobalSummary.parse(summary1.toJsonMap()); |
45 expect(summary2.loose['file:///main.dart'].messages.length, 1); | 45 expect(summary2.loose['file:///main.dart'].messages.length, 1); |
46 expect(summary2.packages['foo'].libraries[barUrl].messages.length, 1); | 46 expect(summary2.packages['foo'].libraries[barUrl].messages.length, 1); |
47 }); | 47 }); |
48 } | 48 } |
OLD | NEW |