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