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

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

Issue 3003263002: add support for native methods in class
Patch Set: update listeners Created 3 years, 3 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:analyzer/dart/ast/ast.dart'; 5 import 'package:analyzer/dart/ast/ast.dart';
6 import 'package:analyzer/dart/ast/token.dart' as analyzer; 6 import 'package:analyzer/dart/ast/token.dart' as analyzer;
7 import 'package:analyzer/dart/ast/token.dart' show TokenType; 7 import 'package:analyzer/dart/ast/token.dart' show TokenType;
8 import 'package:analyzer/error/error.dart'; 8 import 'package:analyzer/error/error.dart';
9 import 'package:analyzer/error/listener.dart' show ErrorReporter; 9 import 'package:analyzer/error/listener.dart' show ErrorReporter;
10 import 'package:analyzer/src/dart/scanner/scanner.dart'; 10 import 'package:analyzer/src/dart/scanner/scanner.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 @reflectiveTest 56 @reflectiveTest
57 class ClassMemberParserTest_Fasta extends FastaParserTestCase 57 class ClassMemberParserTest_Fasta extends FastaParserTestCase
58 with ClassMemberParserTestMixin { 58 with ClassMemberParserTestMixin {
59 @override 59 @override
60 @failingTest 60 @failingTest
61 void test_parseConstructor_assert() { 61 void test_parseConstructor_assert() {
62 // TODO(paulberry): Fasta doesn't support asserts in initializers 62 // TODO(paulberry): Fasta doesn't support asserts in initializers
63 super.test_parseConstructor_assert(); 63 super.test_parseConstructor_assert();
64 } 64 }
65
66 void test_parseClassMember_method_native_allowed() {
67 allowNativeClause = true;
68 test_parseClassMember_method_native();
69 }
70
71 void test_parseClassMember_method_native_not_allowed() {
72 allowNativeClause = false;
73 test_parseClassMember_method_native();
74 }
75
76 void test_parseClassMember_method_native_missing_literal() {
77 createParser('m() native;');
78 var method = parser.parseClassMember('C') as MethodDeclaration;
79 if (!allowNativeClause) {
80 assertErrorsWithCodes([
81 ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION,
82 ]);
83 } else {
84 assertNoErrors();
85 }
86
87 var body = method.body as NativeFunctionBody;
88 expect(body.nativeKeyword, isNotNull);
89 expect(body.stringLiteral, isNull);
90 expect(body.semicolon, isNotNull);
91 }
92
93 void test_parseClassMember_method_native_missing_literal_allowed() {
94 allowNativeClause = true;
95 test_parseClassMember_method_native_missing_literal();
96 }
97
98 void test_parseClassMember_method_native_missing_literal_not_allowed() {
99 allowNativeClause = false;
100 test_parseClassMember_method_native_missing_literal();
101 }
65 } 102 }
66 103
67 /** 104 /**
68 * Tests of the fasta parser based on [ComplexParserTestMixin]. 105 * Tests of the fasta parser based on [ComplexParserTestMixin].
69 */ 106 */
70 @reflectiveTest 107 @reflectiveTest
71 class ComplexParserTest_Fasta extends FastaParserTestCase 108 class ComplexParserTest_Fasta extends FastaParserTestCase
72 with ComplexParserTestMixin { 109 with ComplexParserTestMixin {
73 @override 110 @override
74 @failingTest 111 @failingTest
(...skipping 2951 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 assertNoErrors(); 3063 assertNoErrors();
3027 } 3064 }
3028 3065
3029 @failingTest 3066 @failingTest
3030 void test_parseCompilationUnitMember_abstractAsPrefix2() { 3067 void test_parseCompilationUnitMember_abstractAsPrefix2() {
3031 // TODO(danrubel): should not be generating an error 3068 // TODO(danrubel): should not be generating an error
3032 super.test_parseCompilationUnitMember_abstractAsPrefix(); 3069 super.test_parseCompilationUnitMember_abstractAsPrefix();
3033 assertNoErrors(); 3070 assertNoErrors();
3034 } 3071 }
3035 } 3072 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698