OLD | NEW |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 | 8 |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 | 10 |
11 import 'package:fletchc/src/hub/client_commands.dart'; | 11 import 'package:dartino_compiler/src/hub/client_commands.dart'; |
12 | 12 |
13 import 'package:fletchc/src/hub/hub_main.dart'; | 13 import 'package:dartino_compiler/src/hub/hub_main.dart'; |
14 | 14 |
15 const List<int> stdinCommandData = const <int>[4, 0, 0, 0, 0, 0, 0, 0, 0]; | 15 const List<int> stdinCommandData = const <int>[4, 0, 0, 0, 0, 0, 0, 0, 0]; |
16 | 16 |
17 Future<Null> testControlStream() async { | 17 Future<Null> testControlStream() async { |
18 StreamController<Uint8List> controller = new StreamController<Uint8List>(); | 18 StreamController<Uint8List> controller = new StreamController<Uint8List>(); |
19 | 19 |
20 // Test that one byte at the time is handled. | 20 // Test that one byte at the time is handled. |
21 for (int byte in stdinCommandData) { | 21 for (int byte in stdinCommandData) { |
22 controller.add(new Uint8List.fromList([byte])); | 22 controller.add(new Uint8List.fromList([byte])); |
23 } | 23 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 await controller.close(); | 57 await controller.close(); |
58 | 58 |
59 List<ClientCommand> commands = await commandsFuture; | 59 List<ClientCommand> commands = await commandsFuture; |
60 Expect.equals(6, commands.length); | 60 Expect.equals(6, commands.length); |
61 for (ClientCommand command in commands) { | 61 for (ClientCommand command in commands) { |
62 Expect.stringEquals( | 62 Expect.stringEquals( |
63 'ClientCommand(ClientCommandCode.Stdin, [])', | 63 'ClientCommand(ClientCommandCode.Stdin, [])', |
64 '$command'); | 64 '$command'); |
65 } | 65 } |
66 } | 66 } |
OLD | NEW |