Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: test/worker/worker_test.dart

Issue 1896613002: Move all args to per-request for the worker, and add a test (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: use exit code 70 for internal errors Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/compiler/command.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/worker/worker_test.dart
diff --git a/test/worker/worker_test.dart b/test/worker/worker_test.dart
index bb104450eaf7b9e69fc7216f490d6519e2f22619..d2f4374d4dc218d70b57db5c6995e97b84df6893 100644
--- a/test/worker/worker_test.dart
+++ b/test/worker/worker_test.dart
@@ -14,12 +14,10 @@ import 'package:test/test.dart';
main() {
group('Hello World', () {
+ final argsFile = new File('test/worker/hello_world.args').absolute;
final inputDartFile = new File('test/worker/hello_world.dart').absolute;
final outputJsFile = new File('test/worker/hello_world.js').absolute;
- final executableArgs = [
- 'bin/dartdevc.dart',
- 'compile',
- ];
+ final executableArgs = ['bin/dartdevc.dart', 'compile',];
final compilerArgs = [
'--no-source-map',
'--no-summarize',
@@ -36,6 +34,7 @@ main() {
tearDown(() {
if (inputDartFile.existsSync()) inputDartFile.deleteSync();
if (outputJsFile.existsSync()) outputJsFile.deleteSync();
+ if (argsFile.existsSync()) argsFile.deleteSync();
});
test('can compile in worker mode', () async {
@@ -79,6 +78,19 @@ main() {
expect(result.stderr, isEmpty);
expect(outputJsFile.existsSync(), isTrue);
});
+
+ test('can compile in basic mode with args in a file', () async {
+ argsFile.createSync();
+ argsFile.writeAsStringSync(compilerArgs.join('\n'));
+ var args = new List.from(executableArgs)..add('@${argsFile.path}');
+ var process = await Process.start('dart', args);
+ stderr.addStream(process.stderr);
+ var futureProcessOutput = process.stdout.map(UTF8.decode).toList();
+
+ expect(await process.exitCode, EXIT_CODE_OK);
+ expect((await futureProcessOutput).join(), isEmpty);
+ expect(outputJsFile.existsSync(), isTrue);
+ });
});
group('Hello World with Summaries', () {
@@ -143,8 +155,8 @@ Future<WorkResponse> _readResponse(MessageGrouper messageGrouper) async {
try {
return new WorkResponse.fromBuffer(buffer);
} catch (_) {
- throw 'Failed to parse response: \n'
- 'bytes: $buffer\n'
- 'String: ${new String.fromCharCodes(buffer)}\n';
+ var bufferAsString =
+ buffer == null ? '' : 'String: ${UTF8.decode(buffer)}\n';
+ throw 'Failed to parse response:\nbytes: $buffer\n$bufferAsString';
}
}
« no previous file with comments | « lib/src/compiler/command.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698