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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fasta.scanner.testing.scanner_chain; | 5 library fasta.scanner.testing.scanner_chain; |
6 | 6 |
7 import 'package:testing/testing.dart'; | 7 import 'package:testing/testing.dart'; |
8 | 8 |
9 import 'package:front_end/src/fasta/scanner.dart'; | 9 import '../../scanner.dart'; |
10 | 10 |
11 import 'package:front_end/src/fasta/scanner/io.dart'; | 11 import '../io.dart'; |
12 | 12 |
13 class Read extends Step<TestDescription, List<int>, ChainContext> { | 13 class Read extends Step<TestDescription, List<int>, ChainContext> { |
14 const Read(); | 14 const Read(); |
15 | 15 |
16 String get name => "read"; | 16 String get name => "read"; |
17 | 17 |
18 Future<Result<List<int>>> run( | 18 Future<Result<List<int>>> run( |
19 TestDescription input, ChainContext context) async { | 19 TestDescription input, ChainContext context) async { |
20 return pass(await readBytesFromFile(input.uri)); | 20 return pass(await readBytesFromFile(input.uri)); |
21 } | 21 } |
22 } | 22 } |
23 | 23 |
24 class Scan extends Step<List<int>, ScannerResult, ChainContext> { | 24 class Scan extends Step<List<int>, ScannerResult, ChainContext> { |
25 const Scan(); | 25 const Scan(); |
26 | 26 |
27 String get name => "scan"; | 27 String get name => "scan"; |
28 | 28 |
29 Future<Result<ScannerResult>> run( | 29 Future<Result<ScannerResult>> run( |
30 List<int> bytes, ChainContext context) async { | 30 List<int> bytes, ChainContext context) async { |
31 return pass(scan(bytes)); | 31 return pass(scan(bytes)); |
32 } | 32 } |
33 } | 33 } |
OLD | NEW |