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

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

Issue 979513002: pkg/unittest: Add a server for serving test assets to browsers. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Fix libDir. 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
« lib/src/runner/loader.dart ('K') | « test/io.dart ('k') | no next file » | 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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:path/path.dart' as p; 7 import 'package:path/path.dart' as p;
8 import 'package:unittest/src/backend/state.dart'; 8 import 'package:unittest/src/backend/state.dart';
9 import 'package:unittest/src/runner/loader.dart'; 9 import 'package:unittest/src/runner/loader.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 }); 72 });
73 73
74 test("can load and run a failing test", () { 74 test("can load and run a failing test", () {
75 var liveTest = suite.tests[1].load(suite); 75 var liveTest = suite.tests[1].load(suite);
76 expectSingleFailure(liveTest); 76 expectSingleFailure(liveTest);
77 return liveTest.run().whenComplete(() => liveTest.close()); 77 return liveTest.run().whenComplete(() => liveTest.close());
78 }); 78 });
79 79
80 test("throws a nice error if the package root doesn't exist", () { 80 test("throws a nice error if the package root doesn't exist", () {
81 var loader = new Loader(); 81 var loader = new Loader();
82 expect(() => loader.loadFile(p.join(_sandbox, 'a_test.dart')), 82 expect(() {
83 throwsA(isLoadException( 83 try {
84 "Directory ${p.join(_sandbox, 'packages')} does not exist."))); 84 loader.loadFile(p.join(_sandbox, 'a_test.dart'));
85 } finally {
86 loader.close();
87 }
88 }, throwsA(isLoadException(
89 "Directory ${p.join(_sandbox, 'packages')} does not exist.")));
85 }); 90 });
86 }); 91 });
87 92
88 group(".loadDir()", () { 93 group(".loadDir()", () {
89 test("ignores non-Dart files", () { 94 test("ignores non-Dart files", () {
90 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests); 95 new File(p.join(_sandbox, 'a_test.txt')).writeAsStringSync(_tests);
91 expect(_loader.loadDir(_sandbox), completion(isEmpty)); 96 expect(_loader.loadDir(_sandbox), completion(isEmpty));
92 }); 97 });
93 98
94 test("ignores files in packages/ directories", () { 99 test("ignores files in packages/ directories", () {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 133
129 test("can run tests in those suites", () { 134 test("can run tests in those suites", () {
130 var suite = suites.firstWhere((suite) => suite.name.contains("a_test")); 135 var suite = suites.firstWhere((suite) => suite.name.contains("a_test"));
131 var liveTest = suite.tests[1].load(suite); 136 var liveTest = suite.tests[1].load(suite);
132 expectSingleFailure(liveTest); 137 expectSingleFailure(liveTest);
133 return liveTest.run().whenComplete(() => liveTest.close()); 138 return liveTest.run().whenComplete(() => liveTest.close());
134 }); 139 });
135 }); 140 });
136 }); 141 });
137 } 142 }
OLDNEW
« lib/src/runner/loader.dart ('K') | « test/io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698