| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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/fasta/scanner/string_scanner.dart'; | 5 import 'package:front_end/src/fasta/scanner/string_scanner.dart'; |
| 6 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; | 6 import 'package:front_end/src/fasta/scanner/token.dart' as fasta; |
| 7 import 'package:front_end/src/scanner/token.dart'; | 7 import 'package:front_end/src/scanner/token.dart'; |
| 8 import 'package:front_end/src/scanner/reader.dart' as analyzer; | 8 import 'package:front_end/src/scanner/reader.dart' as analyzer; |
| 9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 expect(token.isSynthetic, false); | 142 expect(token.isSynthetic, false); |
| 143 expect(token.precedingComments.isSynthetic, false); | 143 expect(token.precedingComments.isSynthetic, false); |
| 144 expect(token.previous.isSynthetic, true); | 144 expect(token.previous.isSynthetic, true); |
| 145 expect(token.next.isEof, true); | 145 expect(token.next.isEof, true); |
| 146 expect(token.next.isSynthetic, true); | 146 expect(token.next.isSynthetic, true); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void test_matchesAny() { | 149 void test_matchesAny() { |
| 150 var scanner = new StringScanner('true', includeComments: true); | 150 var scanner = new StringScanner('true', includeComments: true); |
| 151 var token = scanner.tokenize(); | 151 var token = scanner.tokenize(); |
| 152 expect(token.matchesAny([TokenType.KEYWORD]), true); | 152 expect(token.matchesAny([Keyword.TRUE]), true); |
| 153 expect(token.matchesAny([TokenType.AMPERSAND, TokenType.KEYWORD]), true); | 153 expect(token.matchesAny([TokenType.AMPERSAND, Keyword.TRUE]), true); |
| 154 expect(token.matchesAny([TokenType.AMPERSAND]), false); | 154 expect(token.matchesAny([TokenType.AMPERSAND]), false); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void test_built_in_keywords() { | 157 void test_built_in_keywords() { |
| 158 var builtInKeywords = new Set<Keyword>.from([ | 158 var builtInKeywords = new Set<Keyword>.from([ |
| 159 Keyword.ABSTRACT, | 159 Keyword.ABSTRACT, |
| 160 Keyword.AS, | 160 Keyword.AS, |
| 161 Keyword.COVARIANT, | 161 Keyword.COVARIANT, |
| 162 Keyword.DEFERRED, | 162 Keyword.DEFERRED, |
| 163 Keyword.DYNAMIC, | 163 Keyword.DYNAMIC, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // General tokens | 211 // General tokens |
| 212 token = token.next; | 212 token = token.next; |
| 213 expect(token.lexeme, '&'); | 213 expect(token.lexeme, '&'); |
| 214 expect(token.value(), '&'); | 214 expect(token.value(), '&'); |
| 215 // String tokens | 215 // String tokens |
| 216 token = token.next; | 216 token = token.next; |
| 217 expect(token.lexeme, '"home"'); | 217 expect(token.lexeme, '"home"'); |
| 218 expect(token.value(), '"home"'); | 218 expect(token.value(), '"home"'); |
| 219 } | 219 } |
| 220 } | 220 } |
| OLD | NEW |