| 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:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 | 9 |
| 10 import 'package:dev_compiler/devc.dart'; | 10 import 'package:dev_compiler/devc.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 test2() { | 32 test2() { |
| 33 int y = /*info:AssignmentCast*/x; | 33 int y = /*info:AssignmentCast*/x; |
| 34 } | 34 } |
| 35 '''.replaceAll('\n ', '\n'), | 35 '''.replaceAll('\n ', '\n'), |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 var provider = createTestResourceProvider(files); | 38 var provider = createTestResourceProvider(files); |
| 39 var uriResolver = new TestUriResolver(provider); | 39 var uriResolver = new TestUriResolver(provider); |
| 40 var srcOpts = new SourceResolverOptions(useMockSdk: true); | 40 var srcOpts = new SourceResolverOptions(useMockSdk: true); |
| 41 var context = createAnalysisContextWithSources( | 41 var context = createAnalysisContextWithSources( |
| 42 new StrongModeOptions(), srcOpts, fileResolvers: [uriResolver]); | 42 new StrongModeOptions(), srcOpts, |
| 43 fileResolvers: [uriResolver]); |
| 43 var reporter = new SummaryReporter(context); | 44 var reporter = new SummaryReporter(context); |
| 44 new BatchCompiler(context, new CompilerOptions(sourceOptions: srcOpts), | 45 new BatchCompiler(context, new CompilerOptions(sourceOptions: srcOpts), |
| 45 reporter: reporter).compileFromUriString('/main.dart'); | 46 reporter: reporter).compileFromUriString('/main.dart'); |
| 46 | 47 |
| 47 _verifySummary(GlobalSummary summary) { | 48 _verifySummary(GlobalSummary summary) { |
| 48 var mainLib = summary.loose['file:///main.dart']; | 49 var mainLib = summary.loose['file:///main.dart']; |
| 49 expect(mainLib.messages.length, 2); | 50 expect(mainLib.messages.length, 2); |
| 50 var analyzerMsg = mainLib.messages[0]; | 51 var analyzerMsg = mainLib.messages[0]; |
| 51 expect(analyzerMsg.kind, "AnalyzerMessage"); | 52 expect(analyzerMsg.kind, "AnalyzerMessage"); |
| 52 | 53 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 64 expect(barMessage.level, "info"); | 65 expect(barMessage.level, "info"); |
| 65 expect(barMessage.span.text, 'x'); | 66 expect(barMessage.span.text, 'x'); |
| 66 expect(barMessage.span.context, ' int y = /*info:AssignmentCast*/x;\n'); | 67 expect(barMessage.span.context, ' int y = /*info:AssignmentCast*/x;\n'); |
| 67 } | 68 } |
| 68 | 69 |
| 69 var original = reporter.result; | 70 var original = reporter.result; |
| 70 _verifySummary(original); | 71 _verifySummary(original); |
| 71 _verifySummary(GlobalSummary.parse(original.toJsonMap())); | 72 _verifySummary(GlobalSummary.parse(original.toJsonMap())); |
| 72 }); | 73 }); |
| 73 } | 74 } |
| OLD | NEW |