| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:front_end/src/base/errors.dart'; | 5 import 'package:front_end/src/base/errors.dart'; |
| 6 import 'package:front_end/src/base/jenkins_smi_hash.dart'; | 6 import 'package:front_end/src/base/jenkins_smi_hash.dart'; |
| 7 import 'package:front_end/src/scanner/errors.dart'; | 7 import 'package:front_end/src/scanner/errors.dart'; |
| 8 import 'package:front_end/src/scanner/reader.dart'; | 8 import 'package:front_end/src/scanner/reader.dart'; |
| 9 import 'package:front_end/src/scanner/scanner.dart'; | 9 import 'package:front_end/src/scanner/scanner.dart'; |
| 10 import 'package:front_end/src/scanner/token.dart'; | 10 import 'package:front_end/src/scanner/token.dart'; |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 void test_star() { | 925 void test_star() { |
| 926 _assertToken(TokenType.STAR, "*"); | 926 _assertToken(TokenType.STAR, "*"); |
| 927 } | 927 } |
| 928 | 928 |
| 929 void test_star_eq() { | 929 void test_star_eq() { |
| 930 _assertToken(TokenType.STAR_EQ, "*="); | 930 _assertToken(TokenType.STAR_EQ, "*="); |
| 931 } | 931 } |
| 932 | 932 |
| 933 void test_startAndEnd() { | 933 void test_startAndEnd() { |
| 934 Token token = _scan("a"); | 934 Token token = _scan("a"); |
| 935 expect(token.offset, 0); |
| 935 Token previous = token.previous; | 936 Token previous = token.previous; |
| 936 expect(previous.next, token); | 937 expect(previous.next, token); |
| 937 expect(previous.previous, previous); | 938 expect(previous.previous, previous); |
| 939 expect(previous.type, TokenType.EOF); |
| 940 expect(previous.offset, -1); |
| 938 Token next = token.next; | 941 Token next = token.next; |
| 939 expect(next.next, next); | 942 expect(next.next, next); |
| 940 expect(next.previous, token); | 943 expect(next.previous, token); |
| 944 expect(next.type, TokenType.EOF); |
| 945 expect(next.offset, token.offset + token.length); |
| 941 } | 946 } |
| 942 | 947 |
| 943 void test_string_multi_double() { | 948 void test_string_multi_double() { |
| 944 _assertToken(TokenType.STRING, "\"\"\"line1\nline2\"\"\""); | 949 _assertToken(TokenType.STRING, "\"\"\"line1\nline2\"\"\""); |
| 945 } | 950 } |
| 946 | 951 |
| 947 void test_string_multi_embeddedQuotes() { | 952 void test_string_multi_embeddedQuotes() { |
| 948 _assertToken(TokenType.STRING, "\"\"\"line1\n\"\"\nline2\"\"\""); | 953 _assertToken(TokenType.STRING, "\"\"\"line1\n\"\"\nline2\"\"\""); |
| 949 } | 954 } |
| 950 | 955 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 _TestScanner(CharacterReader reader, [this.listener]) : super(reader); | 1517 _TestScanner(CharacterReader reader, [this.listener]) : super(reader); |
| 1513 | 1518 |
| 1514 @override | 1519 @override |
| 1515 void reportError( | 1520 void reportError( |
| 1516 ScannerErrorCode errorCode, int offset, List<Object> arguments) { | 1521 ScannerErrorCode errorCode, int offset, List<Object> arguments) { |
| 1517 if (listener != null) { | 1522 if (listener != null) { |
| 1518 listener.errors.add(new TestError(offset, errorCode, arguments)); | 1523 listener.errors.add(new TestError(offset, errorCode, arguments)); |
| 1519 } | 1524 } |
| 1520 } | 1525 } |
| 1521 } | 1526 } |
| OLD | NEW |