| 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/computer/error.dart'; | 10 import 'package:analysis_server/src/computer/error.dart'; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 helper.createSingleFileProject('int V = 42;'); | 275 helper.createSingleFileProject('int V = 42;'); |
| 276 return helper.waitForOperationsFinished().then((_) { | 276 return helper.waitForOperationsFinished().then((_) { |
| 277 String noFile = '/no-such-file.dart'; | 277 String noFile = '/no-such-file.dart'; |
| 278 helper.addAnalysisSubscriptionHighlights(noFile); | 278 helper.addAnalysisSubscriptionHighlights(noFile); |
| 279 return helper.waitForOperationsFinished().then((_) { | 279 return helper.waitForOperationsFinished().then((_) { |
| 280 var highlights = helper.getHighlights(noFile); | 280 var highlights = helper.getHighlights(noFile); |
| 281 expect(highlights, isEmpty); | 281 expect(highlights, isEmpty); |
| 282 }); | 282 }); |
| 283 }); | 283 }); |
| 284 }); | 284 }); |
| 285 |
| 286 test('after analysis, SDK file', () { |
| 287 AnalysisTestHelper helper = new AnalysisTestHelper(); |
| 288 helper.createSingleFileProject(''' |
| 289 main() { |
| 290 print(42); |
| 291 } |
| 292 '''); |
| 293 return helper.waitForOperationsFinished().then((_) { |
| 294 String file = '/lib/core/core.dart'; |
| 295 helper.addAnalysisSubscriptionNavigation(file); |
| 296 return helper.waitForOperationsFinished().then((_) { |
| 297 var navigationRegions = helper.getNavigation(file); |
| 298 expect(navigationRegions, isNot(isEmpty)); |
| 299 }); |
| 300 }); |
| 301 }); |
| 285 } | 302 } |
| 286 | 303 |
| 287 | 304 |
| 288 int _getSafeInt(Map<String, Object> json, String key, int defaultValue) { | 305 int _getSafeInt(Map<String, Object> json, String key, int defaultValue) { |
| 289 Object value = json[key]; | 306 Object value = json[key]; |
| 290 if (value is int) { | 307 if (value is int) { |
| 291 return value; | 308 return value; |
| 292 } | 309 } |
| 293 return defaultValue; | 310 return defaultValue; |
| 294 } | 311 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 return waitForServerOperationsPerformed(server); | 582 return waitForServerOperationsPerformed(server); |
| 566 } | 583 } |
| 567 | 584 |
| 568 static String _getCodeString(code) { | 585 static String _getCodeString(code) { |
| 569 if (code is List<String>) { | 586 if (code is List<String>) { |
| 570 code = code.join('\n'); | 587 code = code.join('\n'); |
| 571 } | 588 } |
| 572 return code as String; | 589 return code as String; |
| 573 } | 590 } |
| 574 } | 591 } |
| OLD | NEW |