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

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

Issue 983573002: Add support for running browser tests to the test runner. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 years, 9 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:io';
6
7 import 'package:path/path.dart' as p;
8 import 'package:unittest/src/util/exit_codes.dart' as exit_codes;
9 import 'package:unittest/unittest.dart';
10
11 import '../../io.dart';
12
13 String _sandbox;
14
15 void main() {
16 setUp(() {
17 _sandbox = Directory.systemTemp.createTempSync('unittest_').path;
18 });
19
20 tearDown(() {
21 new Directory(_sandbox).deleteSync(recursive: true);
22 });
23
24 test("doesn't intermingle warnings", () {
25 // These files need trailing newlines to work around issue 22667.
26 var testPath1 = p.join(_sandbox, "test1.dart");
27 new File(testPath1).writeAsStringSync("String main() => 12;\n");
28
29 var testPath2 = p.join(_sandbox, "test2.dart");
30 new File(testPath2).writeAsStringSync("int main() => 'foo';\n");
31
32 var result = _runUnittest(["-p", "chrome", "test1.dart", "test2.dart"]);
33 expect(result.stdout, equals("""
34 Compiling test1.dart...
35 test1.dart:1:18:
36 Warning: 'int' is not assignable to 'String'.
37 String main() => 12;
38 ^^
39 Compiling test2.dart...
40 test2.dart:1:15:
41 Warning: 'String' is not assignable to 'int'.
42 int main() => 'foo';
43 ^^^^^
44 """));
45 expect(result.exitCode, equals(exit_codes.data));
46 });
47
48 test("uses colors if the test runner uses colors", () {
49 var testPath = p.join(_sandbox, "test.dart");
50 new File(testPath).writeAsStringSync("String main() => 12;\n");
51
52 var result = _runUnittest(["--color", "-p", "chrome", "test.dart"]);
53 expect(result.stdout, contains('\u001b[35m'));
54 expect(result.exitCode, equals(exit_codes.data));
55 });
56 }
57
58 ProcessResult _runUnittest(List<String> args) =>
59 runUnittest(args, workingDirectory: _sandbox);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698