| 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 analyzer.test.src.context.context_test; | 5 library analyzer.test.src.context.context_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 '''); | 483 '''); |
| 484 LibraryElement libraryElement = context.computeLibraryElement(source); | 484 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 485 expect(libraryElement, isNotNull); | 485 expect(libraryElement, isNotNull); |
| 486 expect(context.computeDocumentationComment(libraryElement), comment); | 486 expect(context.computeDocumentationComment(libraryElement), comment); |
| 487 } | 487 } |
| 488 | 488 |
| 489 void test_computeDocumentationComment_null() { | 489 void test_computeDocumentationComment_null() { |
| 490 expect(context.computeDocumentationComment(null), isNull); | 490 expect(context.computeDocumentationComment(null), isNull); |
| 491 } | 491 } |
| 492 | 492 |
| 493 void test_computeErrors_dart_malformedCode() { |
| 494 Source source = addSource("/lib.dart", "final int , = 42;"); |
| 495 List<AnalysisError> errors = context.computeErrors(source); |
| 496 expect(errors, isNotNull); |
| 497 expect(errors.length > 0, isTrue); |
| 498 } |
| 499 |
| 493 void test_computeErrors_dart_none() { | 500 void test_computeErrors_dart_none() { |
| 494 Source source = addSource("/lib.dart", "library lib;"); | 501 Source source = addSource("/lib.dart", "library lib;"); |
| 495 List<AnalysisError> errors = context.computeErrors(source); | 502 List<AnalysisError> errors = context.computeErrors(source); |
| 496 expect(errors, hasLength(0)); | 503 expect(errors, hasLength(0)); |
| 497 } | 504 } |
| 498 | 505 |
| 499 void test_computeErrors_dart_part() { | 506 void test_computeErrors_dart_part() { |
| 500 Source librarySource = | 507 Source librarySource = |
| 501 addSource("/lib.dart", "library lib; part 'part.dart';"); | 508 addSource("/lib.dart", "library lib; part 'part.dart';"); |
| 502 Source partSource = addSource("/part.dart", "part of 'lib';"); | 509 Source partSource = addSource("/part.dart", "part of 'lib';"); |
| (...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2871 * Initialize the visitor. | 2878 * Initialize the visitor. |
| 2872 */ | 2879 */ |
| 2873 _ElementGatherer(); | 2880 _ElementGatherer(); |
| 2874 | 2881 |
| 2875 @override | 2882 @override |
| 2876 void visitElement(Element element) { | 2883 void visitElement(Element element) { |
| 2877 elements[element] = element; | 2884 elements[element] = element; |
| 2878 super.visitElement(element); | 2885 super.visitElement(element); |
| 2879 } | 2886 } |
| 2880 } | 2887 } |
| OLD | NEW |