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

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

Issue 1055083004: Normalize handling of the package root in the runner. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Unused import 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 | « lib/src/util/io.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/backend/state.dart'; 10 import 'package:test/src/backend/state.dart';
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return liveTest.run().whenComplete(() => liveTest.close()); 81 return liveTest.run().whenComplete(() => liveTest.close());
82 }); 82 });
83 83
84 test("can load and run a failing test", () { 84 test("can load and run a failing test", () {
85 var liveTest = suite.tests[1].load(suite); 85 var liveTest = suite.tests[1].load(suite);
86 expectSingleFailure(liveTest); 86 expectSingleFailure(liveTest);
87 return liveTest.run().whenComplete(() => liveTest.close()); 87 return liveTest.run().whenComplete(() => liveTest.close());
88 }); 88 });
89 }); 89 });
90 90
91 test("throws a nice error if the package root doesn't exist", () {
92 var loader = new Loader([TestPlatform.chrome], root: _sandbox);
93 expect(
94 loader.loadFile(p.join(_sandbox, 'a_test.dart')).first
95 .whenComplete(loader.close),
96 throwsA(isLoadException(
97 "Directory ${p.join(_sandbox, 'packages')} does not exist.")));
98 });
99
100 test("loads a suite both in the browser and the VM", () { 91 test("loads a suite both in the browser and the VM", () {
101 var loader = new Loader([TestPlatform.vm, TestPlatform.chrome], 92 var loader = new Loader([TestPlatform.vm, TestPlatform.chrome],
102 root: _sandbox, 93 root: _sandbox,
103 packageRoot: p.join(packageDir, 'packages')); 94 packageRoot: p.join(packageDir, 'packages'));
104 var path = p.join(_sandbox, 'a_test.dart'); 95 var path = p.join(_sandbox, 'a_test.dart');
105 return loader.loadFile(path).toList().then((suites) { 96 return loader.loadFile(path).toList().then((suites) {
106 expect(suites[0].platform, equals('VM')); 97 expect(suites[0].platform, equals('VM'));
107 expect(suites[0].path, equals(path)); 98 expect(suites[0].path, equals(path));
108 expect(suites[1].platform, equals('Chrome')); 99 expect(suites[1].platform, equals('Chrome'));
109 expect(suites[1].path, equals(path)); 100 expect(suites[1].path, equals(path));
110 101
111 for (var suite in suites) { 102 for (var suite in suites) {
112 expect(suite.tests, hasLength(3)); 103 expect(suite.tests, hasLength(3));
113 expect(suite.tests[0].name, equals("success")); 104 expect(suite.tests[0].name, equals("success"));
114 expect(suite.tests[1].name, equals("failure")); 105 expect(suite.tests[1].name, equals("failure"));
115 expect(suite.tests[2].name, equals("error")); 106 expect(suite.tests[2].name, equals("error"));
116 } 107 }
117 }).whenComplete(loader.close); 108 }).whenComplete(loader.close);
118 }); 109 });
119 } 110 }
OLDNEW
« no previous file with comments | « lib/src/util/io.dart ('k') | test/runner/loader_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698