Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(761)

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2640853005: Make Analyzer, VM and dart2js accept URI strings as part-of library identifier. (Closed)
Patch Set: Add tests, enable flag by default in analyzer. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 List<AnalysisError> errors = context.computeErrors(source); 759 List<AnalysisError> errors = context.computeErrors(source);
760 expect(errors, hasLength(0)); 760 expect(errors, hasLength(0));
761 } 761 }
762 762
763 void test_computeErrors_dart_part() { 763 void test_computeErrors_dart_part() {
764 Source librarySource = 764 Source librarySource =
765 addSource("/lib.dart", "library lib; part 'part.dart';"); 765 addSource("/lib.dart", "library lib; part 'part.dart';");
766 Source partSource = addSource("/part.dart", "part of 'lib';"); 766 Source partSource = addSource("/part.dart", "part of 'lib';");
767 context.parseCompilationUnit(librarySource); 767 context.parseCompilationUnit(librarySource);
768 List<AnalysisError> errors = context.computeErrors(partSource); 768 List<AnalysisError> errors = context.computeErrors(partSource);
769 expect(errors, isNotNull); 769 if (context.analysisOptions.enableUriInPartOf) {
770 expect(errors.length > 0, isTrue); 770 // Should report that 'lib' isn't the correct URI.
Brian Wilkerson 2017/01/25 17:05:14 Could you make this (and similar comments in other
Lasse Reichstein Nielsen 2017/01/26 10:39:13 Done.
771 } else {
772 expect(errors, isNotNull);
773 expect(errors.length > 0, isTrue);
774 }
771 } 775 }
772 776
773 void test_computeErrors_dart_some() { 777 void test_computeErrors_dart_some() {
774 Source source = addSource("/lib.dart", "library 'lib';"); 778 Source source = addSource("/lib.dart", "library 'lib';");
775 List<AnalysisError> errors = context.computeErrors(source); 779 List<AnalysisError> errors = context.computeErrors(source);
776 expect(errors, isNotNull); 780 expect(errors, isNotNull);
777 expect(errors.length > 0, isTrue); 781 expect(errors.length > 0, isTrue);
778 } 782 }
779 783
780 void test_computeErrors_html_none() { 784 void test_computeErrors_html_none() {
(...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after
5439 * Initialize the visitor. 5443 * Initialize the visitor.
5440 */ 5444 */
5441 _ElementGatherer(); 5445 _ElementGatherer();
5442 5446
5443 @override 5447 @override
5444 void visitElement(Element element) { 5448 void visitElement(Element element) {
5445 elements[element] = element; 5449 elements[element] = element;
5446 super.visitElement(element); 5450 super.visitElement(element);
5447 } 5451 }
5448 } 5452 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698