| OLD | NEW |
| 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:front_end/src/fasta/analyzer/token_utils.dart'; | 5 import 'package:front_end/src/fasta/analyzer/token_utils.dart'; |
| 6 import 'package:front_end/src/scanner/errors.dart'; | |
| 7 import 'package:front_end/src/scanner/token.dart'; | 6 import 'package:front_end/src/scanner/token.dart'; |
| 8 import 'package:test/test.dart'; | |
| 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 10 | 8 |
| 9 import 'scanner_fasta_test.dart'; |
| 11 import 'scanner_test.dart'; | 10 import 'scanner_test.dart'; |
| 12 | 11 |
| 13 main() { | 12 main() { |
| 14 defineReflectiveSuite(() { | 13 defineReflectiveSuite(() { |
| 15 defineReflectiveTests(ScannerTest_RoundTrip); | 14 defineReflectiveTests(ScannerTest_RoundTrip); |
| 16 }); | 15 }); |
| 17 } | 16 } |
| 18 | 17 |
| 19 /// Scanner tests that use the analyzer scanner, then convert the resulting | 18 /// Scanner tests that use the analyzer scanner, then convert the resulting |
| 20 /// token stream into a Fasta token stream, then convert back to an analyzer | 19 /// token stream into a Fasta token stream, then convert back to an analyzer |
| 21 /// token stream before verifying assertions. | 20 /// token stream before verifying assertions. |
| 22 /// | 21 /// |
| 23 /// These tests help to validate the correctness of the analyzer->Fasta token | 22 /// These tests help to validate the correctness of the analyzer->Fasta token |
| 24 /// stream conversion. | 23 /// stream conversion. |
| 25 @reflectiveTest | 24 @reflectiveTest |
| 26 class ScannerTest_RoundTrip extends ScannerTest { | 25 class ScannerTest_RoundTrip extends ScannerTest { |
| 27 @override | 26 @override |
| 28 Token scanWithListener(String source, ErrorListener listener, | 27 Token scanWithListener(String source, ErrorListener listener, |
| 29 {bool genericMethodComments: false, | 28 {bool genericMethodComments: false, |
| 30 bool lazyAssignmentOperators: false}) { | 29 bool lazyAssignmentOperators: false}) { |
| 31 var analyzerToken = super.scanWithListener(source, listener, | 30 var analyzerToken = super.scanWithListener(source, listener, |
| 32 genericMethodComments: genericMethodComments, | 31 genericMethodComments: genericMethodComments, |
| 33 lazyAssignmentOperators: lazyAssignmentOperators); | 32 lazyAssignmentOperators: lazyAssignmentOperators); |
| 34 var fastaToken = fromAnalyzerTokenStream(analyzerToken); | 33 var fastaToken = fromAnalyzerTokenStream(analyzerToken); |
| 35 return toAnalyzerTokenStream(fastaToken, | 34 // Since [scanWithListener] reports errors to the listener, we don't |
| 36 (ScannerErrorCode errorCode, int offset, List<Object> arguments) { | 35 // expect any error tokens in the Fasta token stream, so we convert using |
| 37 // Since [scanWithListener] reports errors to the listener, we don't | 36 // ToAnalyzerTokenStreamConverter_NoErrors. |
| 38 // expect any error tokens in the Fasta token stream; so this callback | 37 return new ToAnalyzerTokenStreamConverter_NoErrors() |
| 39 // should never be called. | 38 .convertTokens(fastaToken); |
| 40 fail('Unexpected error reported: $errorCode, $offset, $arguments'); | |
| 41 }); | |
| 42 } | 39 } |
| 43 | 40 |
| 44 @override | 41 @override |
| 45 @failingTest | 42 @failingTest |
| 46 void test_ampersand_ampersand_eq() { | 43 void test_ampersand_ampersand_eq() { |
| 47 // TODO(paulberry,ahe): Fasta scanner doesn't support lazy assignment | 44 // TODO(paulberry,ahe): Fasta scanner doesn't support lazy assignment |
| 48 // operators. | 45 // operators. |
| 49 super.test_ampersand_ampersand_eq(); | 46 super.test_ampersand_ampersand_eq(); |
| 50 } | 47 } |
| 51 | 48 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 super.test_scriptTag_withoutSpace(); | 84 super.test_scriptTag_withoutSpace(); |
| 88 } | 85 } |
| 89 | 86 |
| 90 @override | 87 @override |
| 91 @failingTest | 88 @failingTest |
| 92 void test_scriptTag_withSpace() { | 89 void test_scriptTag_withSpace() { |
| 93 // TODO(paulberry,ahe): Fasta scanner doesn't support script tag | 90 // TODO(paulberry,ahe): Fasta scanner doesn't support script tag |
| 94 super.test_scriptTag_withSpace(); | 91 super.test_scriptTag_withSpace(); |
| 95 } | 92 } |
| 96 } | 93 } |
| OLD | NEW |