| 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:bazel_worker/bazel_worker.dart'; | 9 import 'package:bazel_worker/bazel_worker.dart'; |
| 10 // TODO(jakemac): Remove once this is a part of the testing library. | 10 // TODO(jakemac): Remove once this is a part of the testing library. |
| 11 import 'package:bazel_worker/src/async_message_grouper.dart'; | 11 import 'package:bazel_worker/src/async_message_grouper.dart'; |
| 12 import 'package:bazel_worker/testing.dart'; | 12 import 'package:bazel_worker/testing.dart'; |
| 13 import 'package:path/path.dart' show join, joinAll, toUri; | 13 import 'package:path/path.dart' show join, joinAll; |
| 14 import 'package:test/test.dart'; | 14 import 'package:test/test.dart'; |
| 15 | 15 |
| 16 File file(String path) => new File(joinAll(path.split('/'))).absolute; | 16 File file(String path) => new File(joinAll(path.split('/'))).absolute; |
| 17 | 17 |
| 18 main() { | 18 main() { |
| 19 var dartdevc = join('bin', 'dartdevc.dart'); | 19 var dartdevc = join('bin', 'dartdevc.dart'); |
| 20 group('Hello World', () { | 20 group('Hello World', () { |
| 21 final argsFile = file('test/worker/hello_world.args'); | 21 final argsFile = file('test/worker/hello_world.args'); |
| 22 final inputDartFile = file('test/worker/hello_world.dart'); | 22 final inputDartFile = file('test/worker/hello_world.dart'); |
| 23 final outputJsFile = file('test/worker/out/hello_world.js'); | 23 final outputJsFile = file('test/worker/out/hello_world.js'); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 Future<WorkResponse> _readResponse(MessageGrouper messageGrouper) async { | 367 Future<WorkResponse> _readResponse(MessageGrouper messageGrouper) async { |
| 368 var buffer = (await messageGrouper.next) as List<int>; | 368 var buffer = (await messageGrouper.next) as List<int>; |
| 369 try { | 369 try { |
| 370 return new WorkResponse.fromBuffer(buffer); | 370 return new WorkResponse.fromBuffer(buffer); |
| 371 } catch (_) { | 371 } catch (_) { |
| 372 var bufferAsString = | 372 var bufferAsString = |
| 373 buffer == null ? '' : 'String: ${UTF8.decode(buffer)}\n'; | 373 buffer == null ? '' : 'String: ${UTF8.decode(buffer)}\n'; |
| 374 throw 'Failed to parse response:\nbytes: $buffer\n$bufferAsString'; | 374 throw 'Failed to parse response:\nbytes: $buffer\n$bufferAsString'; |
| 375 } | 375 } |
| 376 } | 376 } |
| OLD | NEW |