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

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

Issue 2910583002: improve fasta interpolation recovery (Closed)
Patch Set: remove unnecessary label 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_test.dart
diff --git a/pkg/front_end/test/scanner_test.dart b/pkg/front_end/test/scanner_test.dart
index 48f199ecac4960eda3874b36ddfe414b15752027..ca8d75e126ca7ac18a1001683c117d87518b9167 100644
--- a/pkg/front_end/test/scanner_test.dart
+++ b/pkg/front_end/test/scanner_test.dart
@@ -136,15 +136,11 @@ class ScannerTest extends ScannerTestBase {
scanner.scanLazyAssignmentOperators = lazyAssignmentOperators;
return scanner.tokenize();
}
-
- @override
- @failingTest
- void test_incomplete_string_interpolation() {
- super.test_incomplete_string_interpolation();
- }
}
abstract class ScannerTestBase {
+ bool usingFasta = false;
+
Token scanWithListener(String source, ErrorListener listener,
{bool genericMethodComments: false, bool lazyAssignmentOperators: false});
@@ -434,12 +430,23 @@ abstract class ScannerTestBase {
void test_incomplete_string_interpolation() {
// https://code.google.com/p/dart/issues/detail?id=18073
- _assertErrorAndTokens(
- ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 9, "\"foo \${bar", [
+ List<Token> expectedTokens = [
new StringToken(TokenType.STRING, "\"foo ", 0),
new StringToken(TokenType.STRING_INTERPOLATION_EXPRESSION, "\${", 5),
- new StringToken(TokenType.IDENTIFIER, "bar", 7)
- ]);
+ new StringToken(TokenType.IDENTIFIER, "bar", 7),
+ ];
+ if (usingFasta) {
+ // fasta inserts synthetic closers
+ expectedTokens.addAll([
+ new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, 10),
+ ]);
+ } else {
+ expectedTokens.addAll([
+ new StringToken(TokenType.STRING, "", 10),
+ ]);
+ }
+ _assertErrorAndTokens(ScannerErrorCode.UNTERMINATED_STRING_LITERAL, 9,
+ "\"foo \${bar", expectedTokens);
}
void test_index() {

Powered by Google App Engine
This is Rietveld 408576698