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

Side by Side Diff: test/get/package_name_test.dart

Issue 1493463002: Disallow invalid package names in Pubspec. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 5 years 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/validator/name.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
(Empty)
1 // Copyright (c) 2014, 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 'package:scheduled_test/scheduled_test.dart';
6
7 import 'package:pub/src/exit_codes.dart' as exit_codes;
8
9 import '../descriptor.dart' as d;
10 import '../test_pub.dart';
11
12 main() {
13 integration("pub get fails with a non-identifier name", () {
14 d.dir(appPath, [
15 d.pubspec({
16 "name": "invalid package name",
17 "version": "1.0.0"
18 })
19 ]).create();
20
21 pubGet(
22 error: contains('"name" field must be a valid Dart identifier.'),
23 exitCode: exit_codes.DATA);
24
25 d.dir(appPath, [
26 // The lockfile should not be created.
27 d.nothing("pubspec.lock"),
28 // The "packages" directory should not have been generated.
29 d.nothing("packages"),
30 // The ".packages" file should not have been created.
31 d.nothing(".packages"),
32 ]).validate();
33 });
34
35 integration("pub get fails with a reserved word name", () {
36 d.dir(appPath, [
37 d.pubspec({
38 "name": "return",
39 "version": "1.0.0"
40 })
41 ]).create();
42
43 pubGet(
44 error: contains('"name" field may not be a Dart reserved word.'),
45 exitCode: exit_codes.DATA);
46
47 d.dir(appPath, [
48 // The lockfile should not be created.
49 d.nothing("pubspec.lock"),
50 // The "packages" directory should not have been generated.
51 d.nothing("packages"),
52 // The ".packages" file should not have been created.
53 d.nothing(".packages"),
54 ]).validate();
55 });
56
57 integration("pub get allows a name with dotted identifiers", () {
58 d.dir(appPath, [
59 d.pubspec({
60 "name": "foo.bar.baz",
61 "version": "1.0.0"
62 }),
63 d.libDir("foo.bar.baz", "foo.bar.baz 1.0.0")
64 ]).create();
65
66 pubGet();
67
68 d.packagesDir({"foo.bar.baz": "1.0.0"}).validate();
69 });
70 }
OLDNEW
« no previous file with comments | « lib/src/validator/name.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698