| OLD | NEW |
| 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 engine.incremental_scanner_test; | 5 library engine.incremental_scanner_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/incremental_scanner.dart'; | 7 import 'package:analyzer/src/generated/incremental_scanner.dart'; |
| 8 import 'package:analyzer/src/generated/scanner.dart'; | 8 import 'package:analyzer/src/generated/scanner.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 267 } |
| 268 | 268 |
| 269 void test_insert_splitIdentifier() { | 269 void test_insert_splitIdentifier() { |
| 270 // "cob;" | 270 // "cob;" |
| 271 // "cow.b;" | 271 // "cow.b;" |
| 272 _scan("co", "", "w.", "b;"); | 272 _scan("co", "", "w.", "b;"); |
| 273 _assertTokens(-1, 3, ["cow", ".", "b", ";"]); | 273 _assertTokens(-1, 3, ["cow", ".", "b", ";"]); |
| 274 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); | 274 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void test_insert_tokens_within_whitespace() { |
| 278 // "a ;" |
| 279 // "a +b ;" |
| 280 _scan("a ", "", "+b", " ;"); |
| 281 _assertTokens(0, 3, ["a", "+", "b", ";"]); |
| 282 expect(_incrementalScanner.hasNonWhitespaceChange, isTrue); |
| 283 } |
| 284 |
| 277 void test_insert_whitespace_beginning_beforeToken() { | 285 void test_insert_whitespace_beginning_beforeToken() { |
| 278 // "a + b;" | 286 // "a + b;" |
| 279 // " a + b;" | 287 // " a + b;" |
| 280 _scan("", "", " ", "a + b;"); | 288 _scan("", "", " ", "a + b;"); |
| 281 _assertTokens(0, 1, ["a", "+", "b", ";"]); | 289 _assertTokens(0, 1, ["a", "+", "b", ";"]); |
| 282 expect(_incrementalScanner.hasNonWhitespaceChange, isFalse); | 290 expect(_incrementalScanner.hasNonWhitespaceChange, isFalse); |
| 283 } | 291 } |
| 284 | 292 |
| 285 void test_insert_whitespace_betweenTokens() { | 293 void test_insert_whitespace_betweenTokens() { |
| 286 // "a + b;" | 294 // "a + b;" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 incrementalToken.type, | 557 incrementalToken.type, |
| 550 same(TokenType.EOF), | 558 same(TokenType.EOF), |
| 551 reason: "Too many tokens"); | 559 reason: "Too many tokens"); |
| 552 expect( | 560 expect( |
| 553 modifiedTokens.type, | 561 modifiedTokens.type, |
| 554 same(TokenType.EOF), | 562 same(TokenType.EOF), |
| 555 reason: "Not enough tokens"); | 563 reason: "Not enough tokens"); |
| 556 // TODO(brianwilkerson) Verify that the errors are correct? | 564 // TODO(brianwilkerson) Verify that the errors are correct? |
| 557 } | 565 } |
| 558 } | 566 } |
| OLD | NEW |