| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 | 3 |
| 4 library engine.scanner_test; | 4 library engine.scanner_test; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'package:analyzer-experimental/src/generated/java_core.dart'; | 7 import 'package:analyzer-experimental/src/generated/java_core.dart'; |
| 8 import 'package:analyzer-experimental/src/generated/java_engine.dart'; | 8 import 'package:analyzer-experimental/src/generated/java_engine.dart'; |
| 9 import 'package:analyzer-experimental/src/generated/java_junit.dart'; | 9 import 'package:analyzer-experimental/src/generated/java_junit.dart'; |
| 10 import 'package:analyzer-experimental/src/generated/source.dart'; | 10 import 'package:analyzer-experimental/src/generated/source.dart'; |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 }); | 774 }); |
| 775 } | 775 } |
| 776 } | 776 } |
| 777 class StringScannerTest extends AbstractScannerTest { | 777 class StringScannerTest extends AbstractScannerTest { |
| 778 void test_setSourceStart() { | 778 void test_setSourceStart() { |
| 779 int offsetDelta = 42; | 779 int offsetDelta = 42; |
| 780 GatheringErrorListener listener = new GatheringErrorListener(); | 780 GatheringErrorListener listener = new GatheringErrorListener(); |
| 781 StringScanner scanner = new StringScanner(null, "a", listener); | 781 StringScanner scanner = new StringScanner(null, "a", listener); |
| 782 scanner.setSourceStart(3, 9, offsetDelta); | 782 scanner.setSourceStart(3, 9, offsetDelta); |
| 783 scanner.tokenize(); | 783 scanner.tokenize(); |
| 784 List<int> lineStarts2 = scanner.lineStarts; | 784 List<int> lineStarts3 = scanner.lineStarts; |
| 785 JUnitTestCase.assertNotNull(lineStarts2); | 785 JUnitTestCase.assertNotNull(lineStarts3); |
| 786 JUnitTestCase.assertEquals(3, lineStarts2.length); | 786 JUnitTestCase.assertEquals(3, lineStarts3.length); |
| 787 JUnitTestCase.assertEquals(33, lineStarts2[2]); | 787 JUnitTestCase.assertEquals(33, lineStarts3[2]); |
| 788 } | 788 } |
| 789 Token scan(String source, GatheringErrorListener listener) { | 789 Token scan(String source, GatheringErrorListener listener) { |
| 790 StringScanner scanner = new StringScanner(null, source, listener); | 790 StringScanner scanner = new StringScanner(null, source, listener); |
| 791 Token result = scanner.tokenize(); | 791 Token result = scanner.tokenize(); |
| 792 listener.setLineInfo(new TestSource(), scanner.lineStarts); | 792 listener.setLineInfo(new TestSource(), scanner.lineStarts); |
| 793 return result; | 793 return result; |
| 794 } | 794 } |
| 795 static dartSuite() { | 795 static dartSuite() { |
| 796 _ut.group('StringScannerTest', () { | 796 _ut.group('StringScannerTest', () { |
| 797 _ut.test('test_ampersand', () { | 797 _ut.test('test_ampersand', () { |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 } | 1435 } |
| 1436 void validateStream(JavaStringBuilder builder, Token token) { | 1436 void validateStream(JavaStringBuilder builder, Token token) { |
| 1437 if (token == null) { | 1437 if (token == null) { |
| 1438 return; | 1438 return; |
| 1439 } | 1439 } |
| 1440 Token previousToken = null; | 1440 Token previousToken = null; |
| 1441 int previousEnd = -1; | 1441 int previousEnd = -1; |
| 1442 Token currentToken = token; | 1442 Token currentToken = token; |
| 1443 while (currentToken != null && currentToken.type != TokenType.EOF) { | 1443 while (currentToken != null && currentToken.type != TokenType.EOF) { |
| 1444 validateStream(builder, currentToken.precedingComments); | 1444 validateStream(builder, currentToken.precedingComments); |
| 1445 TokenType type28 = currentToken.type; | 1445 TokenType type29 = currentToken.type; |
| 1446 if (identical(type28, TokenType.OPEN_CURLY_BRACKET) || identical(type28, T
okenType.OPEN_PAREN) || identical(type28, TokenType.OPEN_SQUARE_BRACKET) || iden
tical(type28, TokenType.STRING_INTERPOLATION_EXPRESSION)) { | 1446 if (identical(type29, TokenType.OPEN_CURLY_BRACKET) || identical(type29, T
okenType.OPEN_PAREN) || identical(type29, TokenType.OPEN_SQUARE_BRACKET) || iden
tical(type29, TokenType.STRING_INTERPOLATION_EXPRESSION)) { |
| 1447 if (currentToken is! BeginToken) { | 1447 if (currentToken is! BeginToken) { |
| 1448 builder.append("\r\nExpected BeginToken, found "); | 1448 builder.append("\r\nExpected BeginToken, found "); |
| 1449 builder.append(currentToken.runtimeType.toString()); | 1449 builder.append(currentToken.runtimeType.toString()); |
| 1450 builder.append(" "); | 1450 builder.append(" "); |
| 1451 writeToken(builder, currentToken); | 1451 writeToken(builder, currentToken); |
| 1452 } | 1452 } |
| 1453 } | 1453 } |
| 1454 int currentStart = currentToken.offset; | 1454 int currentStart = currentToken.offset; |
| 1455 int currentLength = currentToken.length; | 1455 int currentLength = currentToken.length; |
| 1456 int currentEnd = currentStart + currentLength - 1; | 1456 int currentEnd = currentStart + currentLength - 1; |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 listener.assertNoErrors(); | 2054 listener.assertNoErrors(); |
| 2055 return token; | 2055 return token; |
| 2056 } | 2056 } |
| 2057 } | 2057 } |
| 2058 main() { | 2058 main() { |
| 2059 CharBufferScannerTest.dartSuite(); | 2059 CharBufferScannerTest.dartSuite(); |
| 2060 KeywordStateTest.dartSuite(); | 2060 KeywordStateTest.dartSuite(); |
| 2061 StringScannerTest.dartSuite(); | 2061 StringScannerTest.dartSuite(); |
| 2062 TokenTypeTest.dartSuite(); | 2062 TokenTypeTest.dartSuite(); |
| 2063 } | 2063 } |
| OLD | NEW |