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

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

Issue 2996673002: translate missing ">" fasta error code to analyzer error (Closed)
Patch Set: address comments Created 3 years, 4 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
« no previous file with comments | « no previous file | pkg/front_end/lib/src/scanner/errors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library analyzer.test.generated.scanner_test; 5 library analyzer.test.generated.scanner_test;
6 6
7 import 'package:analyzer/dart/ast/token.dart'; 7 import 'package:analyzer/dart/ast/token.dart';
8 import 'package:analyzer/src/dart/ast/token.dart'; 8 import 'package:analyzer/src/dart/ast/token.dart';
9 import 'package:analyzer/src/dart/scanner/reader.dart'; 9 import 'package:analyzer/src/dart/scanner/reader.dart';
10 import 'package:analyzer/src/dart/scanner/scanner.dart'; 10 import 'package:analyzer/src/dart/scanner/scanner.dart';
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void test_setOffset() { 72 void test_setOffset() {
73 CharSequenceReader baseReader = new CharSequenceReader("xyzzy"); 73 CharSequenceReader baseReader = new CharSequenceReader("xyzzy");
74 CharacterRangeReader reader = new CharacterRangeReader(baseReader, 1, 4); 74 CharacterRangeReader reader = new CharacterRangeReader(baseReader, 1, 4);
75 reader.offset = 2; 75 reader.offset = 2;
76 expect(reader.offset, 2); 76 expect(reader.offset, 2);
77 } 77 }
78 } 78 }
79 79
80 @reflectiveTest 80 @reflectiveTest
81 class LineInfoTest extends EngineTestCase { 81 class LineInfoTest extends EngineTestCase {
82 void test_translate_missing_closing_gt_error() {
83 // Ensure that the UnmatchedToken error for missing '>' is translated
84 // to the correct analyzer error code.
85 // See https://github.com/dart-lang/sdk/issues/30320
86 String source = '<!-- @Component(';
87 GatheringErrorListener listener = new GatheringErrorListener();
88 _scanWithListener(source, listener);
89 listener.assertErrorsWithCodes(const [
90 ScannerErrorCode.EXPECTED_TOKEN,
91 ScannerErrorCode.EXPECTED_TOKEN,
92 ]);
93 }
94
82 void test_lineInfo_multilineComment() { 95 void test_lineInfo_multilineComment() {
83 String source = "/*\r\n *\r\n */"; 96 String source = "/*\r\n *\r\n */";
84 _assertLineInfo(source, [ 97 _assertLineInfo(source, [
85 new ScannerTest_ExpectedLocation(0, 1, 1), 98 new ScannerTest_ExpectedLocation(0, 1, 1),
86 new ScannerTest_ExpectedLocation(5, 2, 2), 99 new ScannerTest_ExpectedLocation(5, 2, 2),
87 new ScannerTest_ExpectedLocation(source.length - 1, 3, 3) 100 new ScannerTest_ExpectedLocation(source.length - 1, 3, 3)
88 ]); 101 ]);
89 } 102 }
90 103
91 void test_lineInfo_multilineString() { 104 void test_lineInfo_multilineString() {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 buffer.write(token.type); 253 buffer.write(token.type);
241 buffer.write(", '"); 254 buffer.write(", '");
242 buffer.write(token.lexeme); 255 buffer.write(token.lexeme);
243 buffer.write("', "); 256 buffer.write("', ");
244 buffer.write(token.offset); 257 buffer.write(token.offset);
245 buffer.write(", "); 258 buffer.write(", ");
246 buffer.write(token.length); 259 buffer.write(token.length);
247 buffer.write("]"); 260 buffer.write("]");
248 } 261 }
249 } 262 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/scanner/errors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698