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

Side by Side Diff: pkg/analyzer/test/generated/non_error_resolver_test.dart

Issue 829133007: Enable enum and deferred import support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
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 engine.non_error_resolver_test; 5 library engine.non_error_resolver_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 const A(); 767 const A();
768 set x(value) {} 768 set x(value) {}
769 get x {return 0;} 769 get x {return 0;}
770 }'''); 770 }''');
771 resolve(source); 771 resolve(source);
772 assertNoErrors(source); 772 assertNoErrors(source);
773 verify([source]); 773 verify([source]);
774 } 774 }
775 775
776 void test_constDeferredClass_new() { 776 void test_constDeferredClass_new() {
777 resolveWithAndWithoutExperimental(<String>[r''' 777 resolveWithErrors(<String>[r'''
778 library lib1; 778 library lib1;
779 class A { 779 class A {
780 const A.b(); 780 const A.b();
781 }''', r''' 781 }''', r'''
782 library root; 782 library root;
783 import 'lib1.dart' deferred as a; 783 import 'lib1.dart' deferred as a;
784 main() { 784 main() {
785 new a.A.b(); 785 new a.A.b();
786 }'''], 786 }'''],
787 <ErrorCode>[ParserErrorCode.DEFERRED_IMPORTS_NOT_SUPPORTED],
788 <ErrorCode>[]); 787 <ErrorCode>[]);
789 } 788 }
790 789
791 void test_constEval_functionTypeLiteral() { 790 void test_constEval_functionTypeLiteral() {
792 Source source = addSource(r''' 791 Source source = addSource(r'''
793 typedef F(); 792 typedef F();
794 const C = F;'''); 793 const C = F;''');
795 resolve(source); 794 resolve(source);
796 assertNoErrors(source); 795 assertNoErrors(source);
797 verify([source]); 796 verify([source]);
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 void test_listElementTypeNotAssignable() { 2507 void test_listElementTypeNotAssignable() {
2509 Source source = addSource(r''' 2508 Source source = addSource(r'''
2510 var v1 = <int> [42]; 2509 var v1 = <int> [42];
2511 var v2 = const <int> [42];'''); 2510 var v2 = const <int> [42];''');
2512 resolve(source); 2511 resolve(source);
2513 assertNoErrors(source); 2512 assertNoErrors(source);
2514 verify([source]); 2513 verify([source]);
2515 } 2514 }
2516 2515
2517 void test_loadLibraryDefined() { 2516 void test_loadLibraryDefined() {
2518 resolveWithAndWithoutExperimental(<String>[r''' 2517 resolveWithErrors(<String>[r'''
2519 library lib1; 2518 library lib1;
2520 foo() => 22;''', r''' 2519 foo() => 22;''', r'''
2521 import 'lib1.dart' deferred as other; 2520 import 'lib1.dart' deferred as other;
2522 main() { 2521 main() {
2523 other.loadLibrary().then((_) => other.foo()); 2522 other.loadLibrary().then((_) => other.foo());
2524 }'''], 2523 }'''],
2525 <ErrorCode>[
2526 ParserErrorCode.DEFERRED_IMPORTS_NOT_SUPPORTED,
2527 StaticTypeWarningCode.UNDEFINED_FUNCTION],
2528 <ErrorCode>[]); 2524 <ErrorCode>[]);
2529 } 2525 }
2530 2526
2531 void test_mapKeyTypeNotAssignable() { 2527 void test_mapKeyTypeNotAssignable() {
2532 Source source = addSource("var v = <String, int > {'a' : 1};"); 2528 Source source = addSource("var v = <String, int > {'a' : 1};");
2533 resolve(source); 2529 resolve(source);
2534 assertNoErrors(source); 2530 assertNoErrors(source);
2535 verify([source]); 2531 verify([source]);
2536 } 2532 }
2537 2533
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() { 2606 void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() {
2611 Source source = addSource(r''' 2607 Source source = addSource(r'''
2612 int get x => 0; 2608 int get x => 0;
2613 set x(v) {}'''); 2609 set x(v) {}''');
2614 resolve(source); 2610 resolve(source);
2615 assertNoErrors(source); 2611 assertNoErrors(source);
2616 verify([source]); 2612 verify([source]);
2617 } 2613 }
2618 2614
2619 void test_missingEnumConstantInSwitch_all() { 2615 void test_missingEnumConstantInSwitch_all() {
2620 resetWithEnum();
2621 Source source = addSource(r''' 2616 Source source = addSource(r'''
2622 enum E { A, B, C } 2617 enum E { A, B, C }
2623 2618
2624 f(E e) { 2619 f(E e) {
2625 switch (e) { 2620 switch (e) {
2626 case E.A: break; 2621 case E.A: break;
2627 case E.B: break; 2622 case E.B: break;
2628 case E.C: break; 2623 case E.C: break;
2629 } 2624 }
2630 }'''); 2625 }''');
2631 resolve(source); 2626 resolve(source);
2632 assertNoErrors(source); 2627 assertNoErrors(source);
2633 verify([source]); 2628 verify([source]);
2634 } 2629 }
2635 2630
2636 void test_missingEnumConstantInSwitch_default() { 2631 void test_missingEnumConstantInSwitch_default() {
2637 resetWithEnum();
2638 Source source = addSource(r''' 2632 Source source = addSource(r'''
2639 enum E { A, B, C } 2633 enum E { A, B, C }
2640 2634
2641 f(E e) { 2635 f(E e) {
2642 switch (e) { 2636 switch (e) {
2643 case E.B: break; 2637 case E.B: break;
2644 default: break; 2638 default: break;
2645 } 2639 }
2646 }'''); 2640 }''');
2647 resolve(source); 2641 resolve(source);
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3966 } 3960 }
3967 class _InvertedCodec<T2, S2> extends Codec<T2, S2> { 3961 class _InvertedCodec<T2, S2> extends Codec<T2, S2> {
3968 _InvertedCodec(Codec<S2, T2> codec); 3962 _InvertedCodec(Codec<S2, T2> codec);
3969 }'''); 3963 }''');
3970 resolve(source); 3964 resolve(source);
3971 assertNoErrors(source); 3965 assertNoErrors(source);
3972 verify([source]); 3966 verify([source]);
3973 } 3967 }
3974 3968
3975 void test_sharedDeferredPrefix() { 3969 void test_sharedDeferredPrefix() {
3976 resolveWithAndWithoutExperimental(<String>[r''' 3970 resolveWithErrors(<String>[r'''
3977 library lib1; 3971 library lib1;
3978 f1() {}''', r''' 3972 f1() {}''', r'''
3979 library lib2; 3973 library lib2;
3980 f2() {}''', r''' 3974 f2() {}''', r'''
3981 library lib3; 3975 library lib3;
3982 f3() {}''', r''' 3976 f3() {}''', r'''
3983 library root; 3977 library root;
3984 import 'lib1.dart' deferred as lib1; 3978 import 'lib1.dart' deferred as lib1;
3985 import 'lib2.dart' as lib; 3979 import 'lib2.dart' as lib;
3986 import 'lib3.dart' as lib; 3980 import 'lib3.dart' as lib;
3987 main() { lib1.f1(); lib.f2(); lib.f3(); }'''], 3981 main() { lib1.f1(); lib.f2(); lib.f3(); }'''],
3988 <ErrorCode>[ParserErrorCode.DEFERRED_IMPORTS_NOT_SUPPORTED],
3989 <ErrorCode>[]); 3982 <ErrorCode>[]);
3990 } 3983 }
3991 3984
3992 void test_staticAccessToInstanceMember_annotation() { 3985 void test_staticAccessToInstanceMember_annotation() {
3993 Source source = addSource(r''' 3986 Source source = addSource(r'''
3994 class A { 3987 class A {
3995 const A.name(); 3988 const A.name();
3996 } 3989 }
3997 @A.name() 3990 @A.name()
3998 main() { 3991 main() {
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
4804 resolve(source); 4797 resolve(source);
4805 assertNoErrors(source); 4798 assertNoErrors(source);
4806 verify([source]); 4799 verify([source]);
4807 reset(); 4800 reset();
4808 } 4801 }
4809 4802
4810 void _check_wrongNumberOfParametersForOperator1(String name) { 4803 void _check_wrongNumberOfParametersForOperator1(String name) {
4811 _check_wrongNumberOfParametersForOperator(name, "a"); 4804 _check_wrongNumberOfParametersForOperator(name, "a");
4812 } 4805 }
4813 } 4806 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/incremental_resolver_test.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698