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

Side by Side Diff: tests/compiler/dart2js/dart2js_batch2_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 import 'package:async_helper/async_helper.dart'; 10 import 'package:async_helper/async_helper.dart';
11 import 'package:expect/expect.dart'; 11 import 'package:expect/expect.dart';
12 12
13 var tmpDir; 13 var tmpDir;
14 14
15 copyDirectory(Directory sourceDir, Directory destinationDir) { 15 copyDirectory(Directory sourceDir, Directory destinationDir) {
16 sourceDir.listSync().forEach((FileSystemEntity element) { 16 sourceDir.listSync().forEach((FileSystemEntity element) {
17 String newPath = path.join(destinationDir.path, 17 String newPath =
18 path.basename(element.path)); 18 path.join(destinationDir.path, path.basename(element.path));
19 if (element is File) { 19 if (element is File) {
20 element.copySync(newPath); 20 element.copySync(newPath);
21 } else if (element is Directory) { 21 } else if (element is Directory) {
22 Directory newDestinationDir = new Directory(newPath); 22 Directory newDestinationDir = new Directory(newPath);
23 newDestinationDir.createSync(); 23 newDestinationDir.createSync();
24 copyDirectory(element, newDestinationDir); 24 copyDirectory(element, newDestinationDir);
25 } 25 }
26 }); 26 });
27 } 27 }
28 28
(...skipping 15 matching lines...) Expand all
44 }); 44 });
45 } 45 }
46 46
47 void cleanUp() { 47 void cleanUp() {
48 print("Deleting '${tmpDir.path}'."); 48 print("Deleting '${tmpDir.path}'.");
49 tmpDir.deleteSync(recursive: true); 49 tmpDir.deleteSync(recursive: true);
50 } 50 }
51 51
52 Future launchDart2Js(_) { 52 Future launchDart2Js(_) {
53 String ext = Platform.isWindows ? '.bat' : ''; 53 String ext = Platform.isWindows ? '.bat' : '';
54 String command = 54 String command = path.normalize(path.join(
55 path.normalize(path.join(path.fromUri(Platform.script), 55 path.fromUri(Platform.script), '../../../../sdk/bin/dart2js${ext}'));
56 '../../../../sdk/bin/dart2js${ext}'));
57 print("Running '$command --batch' from '${tmpDir}'."); 56 print("Running '$command --batch' from '${tmpDir}'.");
58 return Process.start(command, ['--batch'], workingDirectory: tmpDir.path); 57 return Process.start(command, ['--batch'], workingDirectory: tmpDir.path);
59 } 58 }
60 59
61 Future runTests(Process process) { 60 Future runTests(Process process) {
62 String inFile = path.join(tmpDir.path, 'dart2js_batch2_run.dart'); 61 String inFile = path.join(tmpDir.path, 'dart2js_batch2_run.dart');
63 String outFile = path.join(tmpDir.path, 'out.js'); 62 String outFile = path.join(tmpDir.path, 'out.js');
64 63
65 process.stdin.writeln('--out="$outFile" "$inFile"'); 64 process.stdin.writeln('--out="$outFile" "$inFile"');
66 process.stdin.close(); 65 process.stdin.close();
67 Future<String> output = process.stdout.transform(UTF8.decoder).join(); 66 Future<String> output = process.stdout.transform(UTF8.decoder).join();
68 Future<String> errorOut = process.stderr.transform(UTF8.decoder).join(); 67 Future<String> errorOut = process.stderr.transform(UTF8.decoder).join();
69 return Future.wait([output, errorOut]) 68 return Future.wait([output, errorOut]).then((result) {
70 .then((result) { 69 String stdoutOutput = result[0];
71 String stdoutOutput = result[0]; 70 String stderrOutput = result[1];
72 String stderrOutput = result[1];
73 71
74 Expect.isFalse(stdoutOutput.contains("crashed")); 72 Expect.isFalse(stdoutOutput.contains("crashed"));
75 }); 73 });
76 } 74 }
77 75
78 void main() { 76 void main() {
79 var tmpDir; 77 var tmpDir;
80 asyncTest(() { 78 asyncTest(() {
81 return setup() 79 return setup().then(launchDart2Js).then(runTests).whenComplete(cleanUp);
82 .then(launchDart2Js)
83 .then(runTests)
84 .whenComplete(cleanUp);
85 }); 80 });
86 } 81 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/container_mask_equal_test.dart ('k') | tests/compiler/dart2js/dart2js_batch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698