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

Unified Diff: pkg/front_end/test/scanner_fasta_test.dart

Issue 2922563002: improve handling of missing interpolation identifier (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/test/scanner_fasta_test.dart
diff --git a/pkg/front_end/test/scanner_fasta_test.dart b/pkg/front_end/test/scanner_fasta_test.dart
index 67f3582c546c195628afee01b191120bb7e9cb62..52c459557b53ed20b6b3569abd93f20e6323b587 100644
--- a/pkg/front_end/test/scanner_fasta_test.dart
+++ b/pkg/front_end/test/scanner_fasta_test.dart
@@ -203,22 +203,6 @@ main() {}
}
@override
- @failingTest
- void test_mismatched_closer() {
- // TODO(paulberry,ahe): Fasta and analyzer recover this error differently.
- // Figure out which recovery technique we want the front end to use.
- super.test_mismatched_closer();
- }
-
- @override
- @failingTest
- void test_mismatched_opener() {
- // TODO(paulberry,ahe): Fasta and analyzer recover this error differently.
- // Figure out which recovery technique we want the front end to use.
- super.test_mismatched_opener();
- }
-
- @override
void test_mismatched_opener_in_interpolation() {
// When openers and closers are mismatched,
// fasta favors considering the opener to be mismatched
@@ -301,6 +285,34 @@ abstract class ScannerTest_Fasta_Base {
}
}
+ void test_string_simple_interpolation_missingIdentifier() {
+ Token token = scan("'\$x\$'");
+ expectToken(token, TokenType.STRING, 0, 1, lexeme: "'");
+
+ token = token.next;
+ expectToken(token, TokenType.STRING_INTERPOLATION_IDENTIFIER, 1, 1);
+
+ token = token.next;
+ expectToken(token, TokenType.IDENTIFIER, 2, 1, lexeme: 'x');
+
+ token = token.next;
+ expectToken(token, TokenType.STRING, 3, 0, lexeme: '', isSynthetic: true);
+
+ token = token.next;
+ expectToken(token, TokenType.STRING_INTERPOLATION_IDENTIFIER, 3, 1);
+
+ token = token.next;
+ expectToken(token, TokenType.IDENTIFIER, 4, 0,
+ lexeme: '', isSynthetic: true);
+
+ token = token.next;
+ expect((token as fasta.ErrorToken).errorCode,
+ same(codeUnexpectedDollarInString));
+
+ token = token.next;
+ expectToken(token, TokenType.STRING, 4, 1, lexeme: "'");
+ }
+
void test_string_simple_unterminated_interpolation_block() {
Token token = scan(r'"foo ${bar');
expectToken(token, TokenType.STRING, 0, 5, lexeme: '"foo ');
@@ -393,6 +405,10 @@ abstract class ScannerTest_Fasta_Base {
expectToken(token, TokenType.STRING_INTERPOLATION_IDENTIFIER, 5, 1);
token = token.next;
+ expectToken(token, TokenType.IDENTIFIER, 6, 0,
+ isSynthetic: true, lexeme: '');
+
+ token = token.next;
expect((token as fasta.ErrorToken).errorCode,
same(codeUnexpectedDollarInString));
expect((token as fasta.UnterminatedToken).start, r'$');

Powered by Google App Engine
This is Rietveld 408576698