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

Side by Side Diff: test/runner/browser/runner_test.dart

Issue 1056733002: Run test tearDowns and clean up temporary directories when a signal is caught. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 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 unified diff | Download patch
« no previous file with comments | « test/runner/browser/loader_test.dart ('k') | test/runner/loader_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 @TestOn("vm") 5 @TestOn("vm")
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 import 'package:test/src/util/exit_codes.dart' as exit_codes; 10 import 'package:test/src/util/exit_codes.dart' as exit_codes;
11 import 'package:test/src/util/io.dart';
11 import 'package:test/test.dart'; 12 import 'package:test/test.dart';
12 13
13 import '../../io.dart'; 14 import '../../io.dart';
14 15
15 String _sandbox; 16 String _sandbox;
16 17
17 final _success = """ 18 final _success = """
18 import 'dart:async'; 19 import 'dart:async';
19 20
20 import 'package:test/test.dart'; 21 import 'package:test/test.dart';
21 22
22 void main() { 23 void main() {
23 test("success", () {}); 24 test("success", () {});
24 } 25 }
25 """; 26 """;
26 27
27 void main() { 28 void main() {
28 setUp(() { 29 setUp(() {
29 _sandbox = Directory.systemTemp.createTempSync('test_').path; 30 _sandbox = createTempDir();
30 }); 31 });
31 32
32 tearDown(() { 33 tearDown(() {
33 new Directory(_sandbox).deleteSync(recursive: true); 34 new Directory(_sandbox).deleteSync(recursive: true);
34 }); 35 });
35 36
36 group("fails gracefully if", () { 37 group("fails gracefully if", () {
37 test("a test file fails to compile", () { 38 test("a test file fails to compile", () {
38 var testPath = p.join(_sandbox, "test.dart"); 39 var testPath = p.join(_sandbox, "test.dart");
39 new File(testPath).writeAsStringSync("invalid Dart file"); 40 new File(testPath).writeAsStringSync("invalid Dart file");
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 """); 174 """);
174 175
175 var result = _runUnittest(["-p", "chrome", "test.dart"]); 176 var result = _runUnittest(["-p", "chrome", "test.dart"]);
176 expect(result.stdout, contains("Hello,\nworld!\n")); 177 expect(result.stdout, contains("Hello,\nworld!\n"));
177 expect(result.exitCode, equals(0)); 178 expect(result.exitCode, equals(0));
178 }); 179 });
179 } 180 }
180 181
181 ProcessResult _runUnittest(List<String> args) => 182 ProcessResult _runUnittest(List<String> args) =>
182 runUnittest(args, workingDirectory: _sandbox); 183 runUnittest(args, workingDirectory: _sandbox);
OLDNEW
« no previous file with comments | « test/runner/browser/loader_test.dart ('k') | test/runner/loader_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698