OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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:unittest/unittest.dart'; | 5 import 'package:test/test.dart'; |
6 import 'package:unittest/src/backend/platform_selector/scanner.dart'; | 6 import 'package:test/src/backend/platform_selector/scanner.dart'; |
7 import 'package:unittest/src/backend/platform_selector/token.dart'; | 7 import 'package:test/src/backend/platform_selector/token.dart'; |
8 | 8 |
9 void main() { | 9 void main() { |
10 group("peek()", () { | 10 group("peek()", () { |
11 test("returns the next token without consuming it", () { | 11 test("returns the next token without consuming it", () { |
12 var scanner = new Scanner("( )"); | 12 var scanner = new Scanner("( )"); |
13 expect(scanner.peek().type, equals(TokenType.leftParen)); | 13 expect(scanner.peek().type, equals(TokenType.leftParen)); |
14 expect(scanner.peek().type, equals(TokenType.leftParen)); | 14 expect(scanner.peek().type, equals(TokenType.leftParen)); |
15 expect(scanner.peek().type, equals(TokenType.leftParen)); | 15 expect(scanner.peek().type, equals(TokenType.leftParen)); |
16 }); | 16 }); |
17 | 17 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // Complicate the selector to test that the span covers it correctly. | 257 // Complicate the selector to test that the span covers it correctly. |
258 var token = _scan(" $selector "); | 258 var token = _scan(" $selector "); |
259 expect(token.type, equals(type)); | 259 expect(token.type, equals(type)); |
260 expect(token.span.text, equals(selector)); | 260 expect(token.span.text, equals(selector)); |
261 expect(token.span.start.offset, equals(3)); | 261 expect(token.span.start.offset, equals(3)); |
262 expect(token.span.end.offset, equals(3 + selector.length)); | 262 expect(token.span.end.offset, equals(3 + selector.length)); |
263 } | 263 } |
264 | 264 |
265 /// Scans a single token from [selector]. | 265 /// Scans a single token from [selector]. |
266 Token _scan(String selector) => new Scanner(selector).next(); | 266 Token _scan(String selector) => new Scanner(selector).next(); |
OLD | NEW |