| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library test.domain.analysis; | 5 library test.domain.analysis; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 return outOfRangeTest(new SourceEdit(-1, 3, 'foo')); | 356 return outOfRangeTest(new SourceEdit(-1, 3, 'foo')); |
| 357 }); | 357 }); |
| 358 | 358 |
| 359 test('beyond end', () { | 359 test('beyond end', () { |
| 360 return outOfRangeTest(new SourceEdit(6, 6, 'foo')); | 360 return outOfRangeTest(new SourceEdit(6, 6, 'foo')); |
| 361 }); | 361 }); |
| 362 }); | 362 }); |
| 363 } | 363 } |
| 364 | 364 |
| 365 | 365 |
| 366 int _getSafeInt(Map<String, Object> json, String key, int defaultValue) { | |
| 367 Object value = json[key]; | |
| 368 if (value is int) { | |
| 369 return value; | |
| 370 } | |
| 371 return defaultValue; | |
| 372 } | |
| 373 | |
| 374 | |
| 375 @ReflectiveTestCase() | 366 @ReflectiveTestCase() |
| 376 class AnalysisDomainTest extends AbstractAnalysisTest { | 367 class AnalysisDomainTest extends AbstractAnalysisTest { |
| 377 Map<String, List<AnalysisError>> filesErrors = {}; | 368 Map<String, List<AnalysisError>> filesErrors = {}; |
| 378 | 369 |
| 379 void processNotification(Notification notification) { | 370 void processNotification(Notification notification) { |
| 380 if (notification.event == ANALYSIS_ERRORS) { | 371 if (notification.event == ANALYSIS_ERRORS) { |
| 381 var decoded = new AnalysisErrorsParams.fromNotification(notification); | 372 var decoded = new AnalysisErrorsParams.fromNotification(notification); |
| 382 filesErrors[decoded.file] = decoded.errors; | 373 filesErrors[decoded.file] = decoded.errors; |
| 383 } | 374 } |
| 384 } | 375 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 return waitForServerOperationsPerformed(server); | 635 return waitForServerOperationsPerformed(server); |
| 645 } | 636 } |
| 646 | 637 |
| 647 static String _getCodeString(code) { | 638 static String _getCodeString(code) { |
| 648 if (code is List<String>) { | 639 if (code is List<String>) { |
| 649 code = code.join('\n'); | 640 code = code.join('\n'); |
| 650 } | 641 } |
| 651 return code as String; | 642 return code as String; |
| 652 } | 643 } |
| 653 } | 644 } |
| OLD | NEW |