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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/serve/web_socket/path_to_urls_errors_test.dart

Issue 896623005: Use native async/await support in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS d.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 library pub_tests;
6
7 import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
8 import 'package:path/path.dart' as p;
9
10 import '../../descriptor.dart' as d;
11 import '../../test_pub.dart';
12 import '../utils.dart';
13
14 main() {
15 // TODO(rnystrom): Split into independent tests.
16 initConfig();
17 integration("pathToUrls errors on bad inputs", () {
18 d.dir(
19 "foo",
20 [
21 d.libPubspec("foo", "1.0.0"),
22 d.dir("web", [d.file("foo.txt", "foo")])]).create();
23
24 d.dir(appPath, [d.appPubspec({
25 "foo": {
26 "path": "../foo"
27 }
28 }),
29 d.file("top-level.txt", "top-level"),
30 d.dir("bin", [d.file("foo.txt", "foo"),]),
31 d.dir("lib", [d.file("myapp.dart", "myapp"),])]).create();
32
33 pubServe(shouldGetFirst: true);
34
35 // Bad arguments.
36 expectWebSocketError("pathToUrls", {
37 "path": 123
38 },
39 rpc_error_code.INVALID_PARAMS,
40 'Parameter "path" for method "pathToUrls" must be a string, but was ' '1 23.');
41
42 expectWebSocketError("pathToUrls", {
43 "path": "main.dart",
44 "line": 12.34
45 },
46 rpc_error_code.INVALID_PARAMS,
47 'Parameter "line" for method "pathToUrls" must be an integer, but was '
48 '12.34.');
49
50 // Unserved directories.
51 expectNotServed(p.join('bin', 'foo.txt'));
52 expectNotServed(p.join('nope', 'foo.txt'));
53 expectNotServed(p.join("..", "bar", "lib", "bar.txt"));
54 expectNotServed(p.join("..", "foo", "web", "foo.txt"));
55
56 endPubServe();
57 });
58 }
59
60 void expectNotServed(String path) {
61 expectWebSocketError("pathToUrls", {
62 "path": path
63 }, NOT_SERVED, 'Asset path "$path" is not currently being served.');
64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698