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

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

Issue 675173004: Add tests of incremental scanner (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.scanner_test; 8 library engine.scanner_test;
9 9
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 void test_setOffset() { 59 void test_setOffset() {
60 CharSequenceReader reader = new CharSequenceReader("xyz"); 60 CharSequenceReader reader = new CharSequenceReader("xyz");
61 reader.offset = 2; 61 reader.offset = 2;
62 expect(reader.offset, 2); 62 expect(reader.offset, 2);
63 } 63 }
64 } 64 }
65 65
66 class IncrementalScannerTest extends EngineTestCase { 66 class IncrementalScannerTest extends EngineTestCase {
67 /** 67 /**
68 * The first token from the token stream resulting from parsing the original s ource, or 68 * The first token from the token stream resulting from parsing the original
69 * `null` if [scan] has not been invoked. 69 * source, or `null` if [scan] has not been invoked.
70 */ 70 */
71 Token _originalTokens; 71 Token _originalTokens;
72 72
73 /** 73 /**
74 * The scanner used to perform incremental scanning, or `null` if [scan] has n ot been 74 * The scanner used to perform incremental scanning, or `null` if [scan] has
75 * invoked. 75 * not been invoked.
76 */ 76 */
77 IncrementalScanner _incrementalScanner; 77 IncrementalScanner _incrementalScanner;
78 78
79 /** 79 /**
80 * The first token from the token stream resulting from performing an incremen tal scan, or 80 * The first token from the token stream resulting from performing an
81 * `null` if [scan] has not been invoked. 81 * incremental scan, or `null` if [scan] has not been invoked.
82 */ 82 */
83 Token _incrementalTokens; 83 Token _incrementalTokens;
84 84
85 void fail_insert_beginning() {
86 // This is currently reporting the changed range as being from 0 to 5, but
87 // that would force us to re-parse both classes, which is clearly sub-optima l.
88 //
89 // "class B {}"
90 // "class A {} class B {}"
91 _scan("", "", "class A {} ", "class B {}");
92 _assertTokens(-1, 4, ["class", "A", "{", "}", "class", "B", "{", "}"]);
93 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
94 }
95
85 void test_delete_identifier_beginning() { 96 void test_delete_identifier_beginning() {
86 // "abs + b;" 97 // "abs + b;"
87 // "s + b;") 98 // "s + b;")
88 _scan("", "ab", "", "s + b;"); 99 _scan("", "ab", "", "s + b;");
89 _assertTokens(-1, 1, ["s", "+", "b", ";"]); 100 _assertTokens(-1, 1, ["s", "+", "b", ";"]);
90 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 101 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
91 } 102 }
92 103
93 void test_delete_identifier_end() { 104 void test_delete_identifier_end() {
94 // "abs + b;" 105 // "abs + b;"
(...skipping 12 matching lines...) Expand all
107 } 118 }
108 119
109 void test_delete_mergeTokens() { 120 void test_delete_mergeTokens() {
110 // "a + b + c;" 121 // "a + b + c;"
111 // "ac;") 122 // "ac;")
112 _scan("a", " + b + ", "", "c;"); 123 _scan("a", " + b + ", "", "c;");
113 _assertTokens(-1, 1, ["ac", ";"]); 124 _assertTokens(-1, 1, ["ac", ";"]);
114 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 125 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
115 } 126 }
116 127
117 void test_insert_afterIdentifier1() { 128 void test_delete_whitespace() {
129 // "a + b + c;"
130 // "a+ b + c;")
131 _scan("a", " ", "", "+ b + c;");
132 _assertTokens(1, 2, ["a", "+", "b", "+", "c", ";"]);
133 expect(_incrementalScanner.hasNonWhitespaceChange, isFalse);
134 }
135
136 void test_insert_afterIdentifier_firstToken() {
118 // "a + b;" 137 // "a + b;"
119 // "abs + b;" 138 // "abs + b;"
120 _scan("a", "", "bs", " + b;"); 139 _scan("a", "", "bs", " + b;");
121 _assertTokens(-1, 1, ["abs", "+", "b", ";"]); 140 _assertTokens(-1, 1, ["abs", "+", "b", ";"]);
122 _assertReplaced(1, "+"); 141 _assertReplaced(1, "+");
123 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 142 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
124 } 143 }
125 144
126 void test_insert_afterIdentifier2() { 145 void test_insert_afterIdentifier_lastToken() {
146 // "a + b"
147 // "a + bc")
148 _scan("a + b", "", "c", "");
149 _assertTokens(1, 3, ["a", "+", "bc"]);
150 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
151 }
152
153 void test_insert_afterIdentifier_middleToken() {
127 // "a + b;" 154 // "a + b;"
128 // "a + by;" 155 // "a + by;"
129 _scan("a + b", "", "y", ";"); 156 _scan("a + b", "", "y", ";");
130 _assertTokens(1, 3, ["a", "+", "by", ";"]); 157 _assertTokens(1, 3, ["a", "+", "by", ";"]);
131 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 158 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
132 } 159 }
133 160
134 void test_insert_beforeIdentifier() { 161 void test_insert_beforeIdentifier() {
135 // "a + b;" 162 // "a + b;"
136 // "a + xb;") 163 // "a + xb;")
(...skipping 11 matching lines...) Expand all
148 } 175 }
149 176
150 void test_insert_convertOneFunctionToTwo() { 177 void test_insert_convertOneFunctionToTwo() {
151 // "f() {}" 178 // "f() {}"
152 // "f() => 0; g() {}" 179 // "f() => 0; g() {}"
153 _scan("f()", "", " => 0; g()", " {}"); 180 _scan("f()", "", " => 0; g()", " {}");
154 _assertTokens(2, 9, ["f", "(", ")", "=>", "0", ";", "g", "(", ")", "{", "}"] ); 181 _assertTokens(2, 9, ["f", "(", ")", "=>", "0", ";", "g", "(", ")", "{", "}"] );
155 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 182 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
156 } 183 }
157 184
185 void test_insert_convertOneFunctionToTwo_overlap() {
186 // "f() {}"
187 // "f() {} g() {}"
188 _scan("f() {", "", "} g() {", "}");
189 _assertTokens(4, 10, ["f", "(", ")", "{", "}", "g", "(", ")", "{", "}"]);
190 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
191 }
192
158 void test_insert_end() { 193 void test_insert_end() {
159 // "class A {}" 194 // "class A {}"
160 // "class A {} class B {}" 195 // "class A {} class B {}"
161 _scan("class A {}", "", " class B {}", ""); 196 _scan("class A {}", "", " class B {}", "");
162 _assertTokens(3, 8, ["class", "A", "{", "}", "class", "B", "{", "}"]); 197 _assertTokens(3, 8, ["class", "A", "{", "}", "class", "B", "{", "}"]);
163 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 198 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
164 } 199 }
165 200
166 void test_insert_insideIdentifier() { 201 void test_insert_insideIdentifier() {
167 // "cob;" 202 // "cob;"
168 // "cow.b;" 203 // "cow.b;"
169 _scan("co", "", "w.", "b;"); 204 _scan("co", "", "w.", "b;");
170 _assertTokens(-1, 3, ["cow", ".", "b", ";"]); 205 _assertTokens(-1, 3, ["cow", ".", "b", ";"]);
171 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 206 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
172 } 207 }
173 208
174 void test_insert_newIdentifier1() { 209 void test_insert_newIdentifier_noSpaceBefore() {
175 // "a; c;" 210 // "a; c;"
176 // "a; b c;" 211 // "a;b c;"
177 _scan("a; ", "", "b", " c;"); 212 _scan("a;", "", "b", " c;");
178 _assertTokens(1, 3, ["a", ";", "b", "c", ";"]);
179 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
180 }
181
182 void test_insert_newIdentifier2() {
183 // "a; c;"
184 // "a;b c;"
185 _scan("a;", "", "b", " c;");
186 _assertTokens(1, 3, ["a", ";", "b", "c", ";"]); 213 _assertTokens(1, 3, ["a", ";", "b", "c", ";"]);
187 _assertReplaced(1, ";"); 214 _assertReplaced(1, ";");
188 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 215 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
189 } 216 }
190 217
218 void test_insert_newIdentifier_spaceBefore() {
219 // "a; c;"
220 // "a; b c;"
221 _scan("a; ", "", "b ", "c;");
222 _assertTokens(1, 3, ["a", ";", "b", "c", ";"]);
223 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
224 }
225
191 void test_insert_period() { 226 void test_insert_period() {
192 // "a + b;" 227 // "a + b;"
193 // "a + b.;" 228 // "a + b.;"
194 _scan("a + b", "", ".", ";"); 229 _scan("a + b", "", ".", ";");
195 _assertTokens(2, 4, ["a", "+", "b", ".", ";"]); 230 _assertTokens(2, 4, ["a", "+", "b", ".", ";"]);
196 } 231 }
197 232
198 void test_insert_period_betweenIdentifiers1() { 233 void test_insert_period_betweenIdentifiers_left() {
199 // "a b;" 234 // "a b;"
200 // "a. b;" 235 // "a. b;"
201 _scan("a", "", ".", " b;"); 236 _scan("a", "", ".", " b;");
202 _assertTokens(0, 2, ["a", ".", "b", ";"]); 237 _assertTokens(0, 2, ["a", ".", "b", ";"]);
203 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 238 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
204 } 239 }
205 240
206 void test_insert_period_betweenIdentifiers2() { 241 void test_insert_period_betweenIdentifiers_middle() {
207 // "a b;"
208 // "a .b;"
209 _scan("a ", "", ".", "b;");
210 _assertTokens(0, 2, ["a", ".", "b", ";"]);
211 }
212
213 void test_insert_period_betweenIdentifiers3() {
214 // "a b;" 242 // "a b;"
215 // "a . b;" 243 // "a . b;"
216 _scan("a ", "", ".", " b;"); 244 _scan("a ", "", ".", " b;");
217 _assertTokens(0, 2, ["a", ".", "b", ";"]); 245 _assertTokens(0, 2, ["a", ".", "b", ";"]);
218 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 246 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
219 } 247 }
220 248
249 void test_insert_period_betweenIdentifiers_right() {
250 // "a b;"
251 // "a .b;"
252 _scan("a ", "", ".", "b;");
253 _assertTokens(0, 2, ["a", ".", "b", ";"]);
254 }
255
221 void test_insert_period_insideExistingIdentifier() { 256 void test_insert_period_insideExistingIdentifier() {
222 // "ab;" 257 // "ab;"
223 // "a.b;" 258 // "a.b;"
224 _scan("a", "", ".", "b;"); 259 _scan("a", "", ".", "b;");
225 _assertTokens(-1, 3, ["a", ".", "b", ";"]); 260 _assertTokens(-1, 3, ["a", ".", "b", ";"]);
226 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); 261 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue);
227 } 262 }
228 263
229 void test_insert_periodAndIdentifier() { 264 void test_insert_periodAndIdentifier() {
230 // "a + b;" 265 // "a + b;"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 Token newToken = tokenMap.get(oldToken); 369 Token newToken = tokenMap.get(oldToken);
335 expect(newToken, isNot(same(oldToken))); 370 expect(newToken, isNot(same(oldToken)));
336 expect(newToken.type, same(oldToken.type)); 371 expect(newToken.type, same(oldToken.type));
337 expect(newToken.lexeme, oldToken.lexeme); 372 expect(newToken.lexeme, oldToken.lexeme);
338 oldToken = oldToken.next; 373 oldToken = oldToken.next;
339 } 374 }
340 expect(_incrementalScanner.hasNonWhitespaceChange, isFalse); 375 expect(_incrementalScanner.hasNonWhitespaceChange, isFalse);
341 } 376 }
342 377
343 /** 378 /**
344 * Assert that the token at the given offset was replaced with a new token hav ing the given 379 * Assert that the token at the given [offset] was replaced with a new token
345 * lexeme. 380 * having the given [lexeme].
346 *
347 * @param tokenOffset the offset of the token being tested
348 * @param lexeme the expected lexeme of the new token
349 */ 381 */
350 void _assertReplaced(int tokenOffset, String lexeme) { 382 void _assertReplaced(int offset, String lexeme) {
351 Token oldToken = _originalTokens; 383 Token oldToken = _originalTokens;
352 for (int i = 0; i < tokenOffset; i++) { 384 for (int i = 0; i < offset; i++) {
353 oldToken = oldToken.next; 385 oldToken = oldToken.next;
354 } 386 }
355 expect(oldToken.lexeme, lexeme); 387 expect(oldToken.lexeme, lexeme);
356 Token newToken = _incrementalScanner.tokenMap.get(oldToken); 388 Token newToken = _incrementalScanner.tokenMap.get(oldToken);
357 expect(newToken, isNotNull); 389 expect(newToken, isNotNull);
358 expect(newToken.lexeme, lexeme); 390 expect(newToken.lexeme, lexeme);
359 expect(newToken, isNot(same(oldToken))); 391 expect(newToken, isNot(same(oldToken)));
360 } 392 }
361 393
362 /** 394 /**
363 * Assert that the result of the incremental scan matches the given list of le xemes and that the 395 * Assert that the result of the incremental scan matches the given list of
364 * left and right tokens correspond to the tokens at the given indices. 396 * [lexemes] and that the left and right tokens correspond to the tokens at
365 * 397 * the [leftIndex] and [rightIndex].
366 * @param leftIndex the expected index of the left token
367 * @param rightIndex the expected index of the right token
368 * @param lexemes the expected lexemes of the resulting tokens
369 */ 398 */
370 void _assertTokens(int leftIndex, int rightIndex, List<String> lexemes) { 399 void _assertTokens(int leftIndex, int rightIndex, List<String> lexemes) {
371 int count = lexemes.length; 400 int count = lexemes.length;
372 expect(leftIndex >= -1 && leftIndex < count, isTrue, reason: "Invalid left i ndex"); 401 expect(
373 expect(rightIndex >= 0 && rightIndex <= count, isTrue, reason: "Invalid righ t index"); 402 leftIndex >= -1 && leftIndex < count,
403 isTrue,
404 reason: "Invalid left index");
405 expect(
406 rightIndex >= 0 && rightIndex <= count,
407 isTrue,
408 reason: "Invalid right index");
374 Token leftToken = null; 409 Token leftToken = null;
375 Token rightToken = null; 410 Token rightToken = null;
376 Token token = _incrementalTokens; 411 Token token = _incrementalTokens;
377 if (leftIndex < 0) { 412 if (leftIndex < 0) {
378 leftToken = token.previous; 413 leftToken = token.previous;
379 } 414 }
380 for (int i = 0; i < count; i++) { 415 for (int i = 0; i < count; i++) {
381 expect(token.lexeme, lexemes[i]); 416 expect(token.lexeme, lexemes[i]);
382 if (i == leftIndex) { 417 if (i == leftIndex) {
383 leftToken = token; 418 leftToken = token;
384 } 419 }
385 if (i == rightIndex) { 420 if (i == rightIndex) {
386 rightToken = token; 421 rightToken = token;
387 } 422 }
388 token = token.next; 423 token = token.next;
389 } 424 }
390 if (rightIndex >= count) { 425 if (rightIndex >= count) {
391 rightToken = token; 426 rightToken = token;
392 } 427 }
393 expect(token.type, same(TokenType.EOF), reason: "Too many tokens"); 428 expect(token.type, same(TokenType.EOF), reason: "Too many tokens");
394 if (leftIndex >= 0) { 429 if (leftIndex >= 0) {
395 expect(leftToken, isNotNull); 430 expect(leftToken, isNotNull);
396 } 431 }
397 expect(_incrementalScanner.leftToken, same(leftToken), reason: "Invalid left token"); 432 expect(
433 _incrementalScanner.leftToken,
434 same(leftToken),
435 reason: "Invalid left token");
398 if (rightIndex >= 0) { 436 if (rightIndex >= 0) {
399 expect(rightToken, isNotNull); 437 expect(rightToken, isNotNull);
400 } 438 }
401 expect(_incrementalScanner.rightToken, same(rightToken), reason: "Invalid ri ght token"); 439 expect(
440 _incrementalScanner.rightToken,
441 same(rightToken),
442 reason: "Invalid right token");
402 } 443 }
403 444
404 /** 445 /**
405 * Given a description of the original and modified contents, perform an incre mental scan of the 446 * Given a description of the original and modified contents, perform an
406 * two pieces of text. Verify that the incremental scan produced the same toke ns as those that 447 * incremental scan of the two pieces of text. Verify that the incremental
407 * would be produced by a full scan of the new contents. 448 * scan produced the same tokens as those that would be produced by a full
449 * scan of the new contents.
408 * 450 *
409 * @param prefix the unchanged text before the edit region 451 * The original content is the concatenation of the [prefix], [removed] and
410 * @param removed the text that was removed from the original contents 452 * [suffix] fragments. The modeified content is the concatenation of the
411 * @param added the text that was added to the modified contents 453 * [prefix], [added] and [suffix] fragments.
412 * @param suffix the unchanged text after the edit region
413 */ 454 */
414 void _scan(String prefix, String removed, String added, String suffix) { 455 void _scan(String prefix, String removed, String added, String suffix) {
415 // 456 //
416 // Compute the information needed to perform the test. 457 // Compute the information needed to perform the test.
417 // 458 //
418 String originalContents = "$prefix$removed$suffix"; 459 String originalContents = "$prefix$removed$suffix";
419 String modifiedContents = "$prefix$added$suffix"; 460 String modifiedContents = "$prefix$added$suffix";
420 int replaceStart = prefix.length; 461 int replaceStart = prefix.length;
421 Source source = new TestSource(); 462 Source source = new TestSource();
422 // 463 //
423 // Scan the original contents. 464 // Scan the original contents.
424 // 465 //
425 GatheringErrorListener originalListener = new GatheringErrorListener(); 466 GatheringErrorListener originalListener = new GatheringErrorListener();
426 Scanner originalScanner = new Scanner(source, new CharSequenceReader(origina lContents), originalListener); 467 Scanner originalScanner = new Scanner(
468 source,
469 new CharSequenceReader(originalContents),
470 originalListener);
427 _originalTokens = originalScanner.tokenize(); 471 _originalTokens = originalScanner.tokenize();
428 expect(_originalTokens, isNotNull); 472 expect(_originalTokens, isNotNull);
429 // 473 //
430 // Scan the modified contents. 474 // Scan the modified contents.
431 // 475 //
432 GatheringErrorListener modifiedListener = new GatheringErrorListener(); 476 GatheringErrorListener modifiedListener = new GatheringErrorListener();
433 Scanner modifiedScanner = new Scanner(source, new CharSequenceReader(modifie dContents), modifiedListener); 477 Scanner modifiedScanner = new Scanner(
478 source,
479 new CharSequenceReader(modifiedContents),
480 modifiedListener);
434 Token modifiedTokens = modifiedScanner.tokenize(); 481 Token modifiedTokens = modifiedScanner.tokenize();
435 expect(modifiedTokens, isNotNull); 482 expect(modifiedTokens, isNotNull);
436 // 483 //
437 // Incrementally scan the modified contents. 484 // Incrementally scan the modified contents.
438 // 485 //
439 GatheringErrorListener incrementalListener = new GatheringErrorListener(); 486 GatheringErrorListener incrementalListener = new GatheringErrorListener();
440 _incrementalScanner = new IncrementalScanner(source, new CharSequenceReader( modifiedContents), incrementalListener); 487 _incrementalScanner = new IncrementalScanner(
441 _incrementalTokens = _incrementalScanner.rescan(_originalTokens, replaceStar t, removed.length, added.length); 488 source,
489 new CharSequenceReader(modifiedContents),
490 incrementalListener);
491 _incrementalTokens = _incrementalScanner.rescan(
492 _originalTokens,
493 replaceStart,
494 removed.length,
495 added.length);
442 // 496 //
443 // Validate that the results of the incremental scan are the same as the ful l scan of the 497 // Validate that the results of the incremental scan are the same as the
444 // modified source. 498 // full scan of the modified source.
445 // 499 //
446 Token incrementalToken = _incrementalTokens; 500 Token incrementalToken = _incrementalTokens;
447 expect(incrementalToken, isNotNull); 501 expect(incrementalToken, isNotNull);
448 while (incrementalToken.type != TokenType.EOF && modifiedTokens.type != Toke nType.EOF) { 502 while (incrementalToken.type != TokenType.EOF
449 expect(incrementalToken.type, same(modifiedTokens.type), reason: "Wrong ty pe for token"); 503 && modifiedTokens.type != TokenType.EOF) {
450 expect(incrementalToken.offset, modifiedTokens.offset, reason: "Wrong offs et for token"); 504 expect(
451 expect(incrementalToken.length, modifiedTokens.length, reason: "Wrong leng th for token"); 505 incrementalToken.type,
452 expect(incrementalToken.lexeme, modifiedTokens.lexeme, reason: "Wrong lexe me for token"); 506 same(modifiedTokens.type),
507 reason: "Wrong type for token");
508 expect(
509 incrementalToken.offset,
510 modifiedTokens.offset,
511 reason: "Wrong offset for token");
512 expect(
513 incrementalToken.length,
514 modifiedTokens.length,
515 reason: "Wrong length for token");
516 expect(
517 incrementalToken.lexeme,
518 modifiedTokens.lexeme,
519 reason: "Wrong lexeme for token");
453 incrementalToken = incrementalToken.next; 520 incrementalToken = incrementalToken.next;
454 modifiedTokens = modifiedTokens.next; 521 modifiedTokens = modifiedTokens.next;
455 } 522 }
456 expect(incrementalToken.type, same(TokenType.EOF), reason: "Too many tokens" ); 523 expect(
457 expect(modifiedTokens.type, same(TokenType.EOF), reason: "Not enough tokens" ); 524 incrementalToken.type,
525 same(TokenType.EOF),
526 reason: "Too many tokens");
527 expect(
528 modifiedTokens.type,
529 same(TokenType.EOF),
530 reason: "Not enough tokens");
458 // TODO(brianwilkerson) Verify that the errors are correct? 531 // TODO(brianwilkerson) Verify that the errors are correct?
459 } 532 }
460 } 533 }
461 534
462 class KeywordStateTest { 535 class KeywordStateTest {
463 void test_KeywordState() { 536 void test_KeywordState() {
464 // 537 //
465 // Generate the test data to be scanned. 538 // Generate the test data to be scanned.
466 // 539 //
467 List<Keyword> keywords = Keyword.values; 540 List<Keyword> keywords = Keyword.values;
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 } 1708 }
1636 1709
1637 main() { 1710 main() {
1638 groupSep = ' | '; 1711 groupSep = ' | ';
1639 runReflectiveTests(CharSequenceReaderTest); 1712 runReflectiveTests(CharSequenceReaderTest);
1640 runReflectiveTests(IncrementalScannerTest); 1713 runReflectiveTests(IncrementalScannerTest);
1641 runReflectiveTests(KeywordStateTest); 1714 runReflectiveTests(KeywordStateTest);
1642 runReflectiveTests(ScannerTest); 1715 runReflectiveTests(ScannerTest);
1643 runReflectiveTests(TokenTypeTest); 1716 runReflectiveTests(TokenTypeTest);
1644 } 1717 }
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