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

Side by Side Diff: pkg/front_end/test/scanner_roundtrip_test.dart

Issue 2689733003: Add the ability to convert an analyzer token stream to a Fasta one. (Closed)
Patch Set: Created 3 years, 10 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:front_end/src/fasta/analyzer/token_utils.dart';
6 import 'package:front_end/src/fasta/scanner/error_token.dart' as fasta;
7 import 'package:front_end/src/fasta/scanner/keyword.dart' as fasta;
8 import 'package:front_end/src/fasta/scanner/string_scanner.dart' as fasta;
9 import 'package:front_end/src/fasta/scanner/token.dart' as fasta;
10 import 'package:front_end/src/fasta/scanner/token_constants.dart' as fasta;
11 import 'package:front_end/src/scanner/errors.dart';
12 import 'package:front_end/src/scanner/token.dart';
13 import 'package:test/test.dart';
14 import 'package:test_reflective_loader/test_reflective_loader.dart';
15
16 import 'scanner_test.dart';
17
18 main() {
19 defineReflectiveSuite(() {
20 defineReflectiveTests(ScannerTest_RoundTrip);
21 });
22 }
23
24 /// Scanner tests that use the analyzer scanner, then convert the resulting
25 /// token stream into a Fasta token stream, then convert back to an analyzer
26 /// token stream before verifying assertions.
27 ///
28 /// These tests help to validate the correctness of the analyzer->Fasta token
29 /// stream conversion.
30 @reflectiveTest
31 class ScannerTest_RoundTrip extends ScannerTest {
32 @override
33 Token scanWithListener(String source, ErrorListener listener,
34 {bool genericMethodComments: false,
35 bool lazyAssignmentOperators: false}) {
36 var analyzerToken = super.scanWithListener(source, listener,
37 genericMethodComments: genericMethodComments,
38 lazyAssignmentOperators: lazyAssignmentOperators);
39 var fastaToken = fromAnalyzerTokenStream(analyzerToken);
40 return toAnalyzerTokenStream(fastaToken,
41 (ScannerErrorCode errorCode, int offset, List<Object> arguments) {
42 // Since [scanWithListener] reports errors to the listener, we don't
43 // expect any error tokens in the Fasta token stream; so this callback
44 // should never be called.
45 fail('Unexpected error reported: $errorCode, $offset, $arguments');
46 });
47 }
48
49 @override
50 @failingTest
51 void test_ampersand_ampersand_eq() {
52 // TODO(paulberry,ahe): Fasta scanner doesn't support lazy assignment
53 // operators.
54 super.test_ampersand_ampersand_eq();
55 }
56
57 @override
58 @failingTest
59 void test_bar_bar_eq() {
60 // TODO(paulberry,ahe): Fasta scanner doesn't support lazy assignment
61 // operators.
62 super.test_bar_bar_eq();
63 }
64
65 @override
66 @failingTest
67 void test_comment_generic_method_type_assign() {
68 // TODO(paulberry,ahe): Fasta scanner doesn't support generic comment
69 // syntax.
70 super.test_comment_generic_method_type_assign();
71 }
72
73 @override
74 @failingTest
75 void test_comment_generic_method_type_list() {
76 // TODO(paulberry,ahe): Fasta scanner doesn't support generic comment
77 // syntax.
78 super.test_comment_generic_method_type_list();
79 }
80
81 @override
82 @failingTest
83 void test_scriptTag_withArgs() {
84 // TODO(paulberry,ahe): Fasta scanner doesn't support script tag
85 super.test_scriptTag_withArgs();
86 }
87
88 @override
89 @failingTest
90 void test_scriptTag_withoutSpace() {
91 // TODO(paulberry,ahe): Fasta scanner doesn't support script tag
92 super.test_scriptTag_withoutSpace();
93 }
94
95 @override
96 @failingTest
97 void test_scriptTag_withSpace() {
98 // TODO(paulberry,ahe): Fasta scanner doesn't support script tag
99 super.test_scriptTag_withSpace();
100 }
101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698