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

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

Issue 2911243003: fix scanner test expectations (Closed)
Patch Set: Created 3 years, 6 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 | no next file » | 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 void test_linestarts() { 126 void test_linestarts() {
127 String source = "var\r\ni\n=\n1;\n"; 127 String source = "var\r\ni\n=\n1;\n";
128 GatheringErrorListener listener = new GatheringErrorListener(); 128 GatheringErrorListener listener = new GatheringErrorListener();
129 Scanner scanner = 129 Scanner scanner =
130 new Scanner(null, new CharSequenceReader(source), listener); 130 new Scanner(null, new CharSequenceReader(source), listener);
131 var token = scanner.tokenize(); 131 var token = scanner.tokenize();
132 expect(token.lexeme, 'var'); 132 expect(token.lexeme, 'var');
133 var lineStarts = scanner.lineStarts; 133 var lineStarts = scanner.lineStarts;
134 expect(lineStarts, orderedEquals([0, 5, 7, 9, 12])); 134 expect(lineStarts, orderedEquals([0, 5, 7, 9, 11]));
135 } 135 }
136 136
137 void _assertLineInfo( 137 void _assertLineInfo(
138 String source, List<ScannerTest_ExpectedLocation> expectedLocations) { 138 String source, List<ScannerTest_ExpectedLocation> expectedLocations) {
139 GatheringErrorListener listener = new GatheringErrorListener(); 139 GatheringErrorListener listener = new GatheringErrorListener();
140 _scanWithListener(source, listener); 140 _scanWithListener(source, listener);
141 listener.assertNoErrors(); 141 listener.assertNoErrors();
142 LineInfo info = listener.getLineInfo(new TestSource()); 142 LineInfo info = listener.getLineInfo(new TestSource());
143 expect(info, isNotNull); 143 expect(info, isNotNull);
144 int count = expectedLocations.length; 144 int count = expectedLocations.length;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 buffer.write(token.type); 238 buffer.write(token.type);
239 buffer.write(", '"); 239 buffer.write(", '");
240 buffer.write(token.lexeme); 240 buffer.write(token.lexeme);
241 buffer.write("', "); 241 buffer.write("', ");
242 buffer.write(token.offset); 242 buffer.write(token.offset);
243 buffer.write(", "); 243 buffer.write(", ");
244 buffer.write(token.length); 244 buffer.write(token.length);
245 buffer.write("]"); 245 buffer.write("]");
246 } 246 }
247 } 247 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698