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

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

Issue 842503003: Enable async 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 }'''); 290 }''');
291 addNamedSource("/lib1.dart", r''' 291 addNamedSource("/lib1.dart", r'''
292 library lib1; 292 library lib1;
293 bool x = false;'''); 293 bool x = false;''');
294 resolve(source); 294 resolve(source);
295 assertNoErrors(source); 295 assertNoErrors(source);
296 verify([source]); 296 verify([source]);
297 } 297 }
298 298
299 void test_asyncForInWrongContext_async() { 299 void test_asyncForInWrongContext_async() {
300 resetWithAsync();
301 Source source = addSource(r''' 300 Source source = addSource(r'''
302 f(list) async { 301 f(list) async {
303 await for (var e in list) { 302 await for (var e in list) {
304 } 303 }
305 }'''); 304 }''');
306 resolve(source); 305 resolve(source);
307 assertNoErrors(source); 306 assertNoErrors(source);
308 verify([source]); 307 verify([source]);
309 } 308 }
310 309
311 void test_asyncForInWrongContext_asyncStar() { 310 void test_asyncForInWrongContext_asyncStar() {
312 resetWithAsync();
313 Source source = addSource(r''' 311 Source source = addSource(r'''
314 f(list) async* { 312 f(list) async* {
315 await for (var e in list) { 313 await for (var e in list) {
316 } 314 }
317 }'''); 315 }''');
318 resolve(source); 316 resolve(source);
319 assertNoErrors(source); 317 assertNoErrors(source);
320 verify([source]); 318 verify([source]);
321 } 319 }
322 320
323 void test_awaitInWrongContext_async() { 321 void test_awaitInWrongContext_async() {
324 resetWithAsync();
325 Source source = addSource(r''' 322 Source source = addSource(r'''
326 f(x, y) async { 323 f(x, y) async {
327 return await x + await y; 324 return await x + await y;
328 }'''); 325 }''');
329 resolve(source); 326 resolve(source);
330 assertNoErrors(source); 327 assertNoErrors(source);
331 verify([source]); 328 verify([source]);
332 } 329 }
333 330
334 void test_awaitInWrongContext_asyncStar() { 331 void test_awaitInWrongContext_asyncStar() {
335 resetWithAsync();
336 Source source = addSource(r''' 332 Source source = addSource(r'''
337 f(x, y) async* { 333 f(x, y) async* {
338 yield await x + await y; 334 yield await x + await y;
339 }'''); 335 }''');
340 resolve(source); 336 resolve(source);
341 assertNoErrors(source); 337 assertNoErrors(source);
342 verify([source]); 338 verify([source]);
343 } 339 }
344 340
345 void test_breakWithoutLabelInSwitch() { 341 void test_breakWithoutLabelInSwitch() {
(...skipping 3478 matching lines...) Expand 10 before | Expand all | Expand 10 after
3824 Source source = addSource(r''' 3820 Source source = addSource(r'''
3825 class A { 3821 class A {
3826 A() { return; } 3822 A() { return; }
3827 }'''); 3823 }''');
3828 resolve(source); 3824 resolve(source);
3829 assertNoErrors(source); 3825 assertNoErrors(source);
3830 verify([source]); 3826 verify([source]);
3831 } 3827 }
3832 3828
3833 void test_returnInGenerator_async() { 3829 void test_returnInGenerator_async() {
3834 resetWithAsync();
3835 Source source = addSource(r''' 3830 Source source = addSource(r'''
3836 f() async { 3831 f() async {
3837 return 0; 3832 return 0;
3838 }'''); 3833 }''');
3839 resolve(source); 3834 resolve(source);
3840 assertNoErrors(source); 3835 assertNoErrors(source);
3841 verify([source]); 3836 verify([source]);
3842 } 3837 }
3843 3838
3844 void test_returnInGenerator_sync() { 3839 void test_returnInGenerator_sync() {
3845 Source source = addSource(r''' 3840 Source source = addSource(r'''
3846 f() { 3841 f() {
3847 return 0; 3842 return 0;
3848 }'''); 3843 }''');
3849 resolve(source); 3844 resolve(source);
3850 assertNoErrors(source); 3845 assertNoErrors(source);
3851 verify([source]); 3846 verify([source]);
3852 } 3847 }
3853 3848
3854 void test_returnOfInvalidType_async() { 3849 void test_returnOfInvalidType_async() {
3855 AnalysisOptionsImpl options =
3856 new AnalysisOptionsImpl.con1(analysisContext2.analysisOptions);
3857 options.enableAsync = true;
3858 resetWithOptions(options);
3859 Source source = addSource(r''' 3850 Source source = addSource(r'''
3860 import 'dart:async'; 3851 import 'dart:async';
3861 class A { 3852 class A {
3862 Future<int> m() async { 3853 Future<int> m() async {
3863 return 0; 3854 return 0;
3864 } 3855 }
3865 }'''); 3856 }''');
3866 resolve(source); 3857 resolve(source);
3867 assertNoErrors(source); 3858 assertNoErrors(source);
3868 verify([source]); 3859 verify([source]);
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
4758 Source source = addSource(r''' 4749 Source source = addSource(r'''
4759 class A { 4750 class A {
4760 set x(a) {} 4751 set x(a) {}
4761 }'''); 4752 }''');
4762 resolve(source); 4753 resolve(source);
4763 assertNoErrors(source); 4754 assertNoErrors(source);
4764 verify([source]); 4755 verify([source]);
4765 } 4756 }
4766 4757
4767 void test_yieldEachInNonGenerator_asyncStar() { 4758 void test_yieldEachInNonGenerator_asyncStar() {
4768 resetWithAsync();
4769 Source source = addSource(r''' 4759 Source source = addSource(r'''
4770 f() async* { 4760 f() async* {
4771 yield* 0; 4761 yield* 0;
4772 }'''); 4762 }''');
4773 resolve(source); 4763 resolve(source);
4774 assertNoErrors(source); 4764 assertNoErrors(source);
4775 verify([source]); 4765 verify([source]);
4776 } 4766 }
4777 4767
4778 void test_yieldEachInNonGenerator_syncStar() { 4768 void test_yieldEachInNonGenerator_syncStar() {
4779 resetWithAsync();
4780 Source source = addSource(r''' 4769 Source source = addSource(r'''
4781 f() sync* { 4770 f() sync* {
4782 yield* 0; 4771 yield* 0;
4783 }'''); 4772 }''');
4784 resolve(source); 4773 resolve(source);
4785 assertNoErrors(source); 4774 assertNoErrors(source);
4786 verify([source]); 4775 verify([source]);
4787 } 4776 }
4788 4777
4789 void test_yieldInNonGenerator_asyncStar() { 4778 void test_yieldInNonGenerator_asyncStar() {
4790 resetWithAsync();
4791 Source source = addSource(r''' 4779 Source source = addSource(r'''
4792 f() async* { 4780 f() async* {
4793 yield 0; 4781 yield 0;
4794 }'''); 4782 }''');
4795 resolve(source); 4783 resolve(source);
4796 assertNoErrors(source); 4784 assertNoErrors(source);
4797 verify([source]); 4785 verify([source]);
4798 } 4786 }
4799 4787
4800 void test_yieldInNonGenerator_syncStar() { 4788 void test_yieldInNonGenerator_syncStar() {
4801 resetWithAsync();
4802 Source source = addSource(r''' 4789 Source source = addSource(r'''
4803 f() sync* { 4790 f() sync* {
4804 yield 0; 4791 yield 0;
4805 }'''); 4792 }''');
4806 resolve(source); 4793 resolve(source);
4807 assertNoErrors(source); 4794 assertNoErrors(source);
4808 verify([source]); 4795 verify([source]);
4809 } 4796 }
4810 4797
4811 void _check_wrongNumberOfParametersForOperator(String name, 4798 void _check_wrongNumberOfParametersForOperator(String name,
4812 String parameters) { 4799 String parameters) {
4813 Source source = addSource(""" 4800 Source source = addSource("""
4814 class A { 4801 class A {
4815 operator $name($parameters) {} 4802 operator $name($parameters) {}
4816 }"""); 4803 }""");
4817 resolve(source); 4804 resolve(source);
4818 assertNoErrors(source); 4805 assertNoErrors(source);
4819 verify([source]); 4806 verify([source]);
4820 reset(); 4807 reset();
4821 } 4808 }
4822 4809
4823 void _check_wrongNumberOfParametersForOperator1(String name) { 4810 void _check_wrongNumberOfParametersForOperator1(String name) {
4824 _check_wrongNumberOfParametersForOperator(name, "a"); 4811 _check_wrongNumberOfParametersForOperator(name, "a");
4825 } 4812 }
4826 } 4813 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/engine_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