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

Side by Side Diff: utils/tests/pub/validator/name_test.dart

Issue 14297021: Move pub into sdk/lib/_internal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Disallow package: imports of pub. Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, 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:pathos/path.dart' as path;
6 import 'package:scheduled_test/scheduled_test.dart';
7
8 import '../../../pub/entrypoint.dart';
9 import '../../../pub/io.dart';
10 import '../../../pub/validator.dart';
11 import '../../../pub/validator/name.dart';
12 import '../descriptor.dart' as d;
13 import '../test_pub.dart';
14 import 'utils.dart';
15
16 Validator name(Entrypoint entrypoint) => new NameValidator(entrypoint);
17
18 main() {
19 initConfig();
20
21 group('should consider a package valid if it', () {
22 setUp(d.validPackage.create);
23
24 integration('looks normal', () => expectNoValidationError(name));
25
26 integration('has a badly-named library in lib/src', () {
27 d.dir(appPath, [
28 d.libPubspec("test_pkg", "1.0.0"),
29 d.dir("lib", [
30 d.file("test_pkg.dart", "int i = 1;"),
31 d.dir("src", [d.file("8ball.dart", "int j = 2;")])
32 ])
33 ]).create();
34 expectNoValidationError(name);
35 });
36 });
37
38 group('should consider a package invalid if it', () {
39 setUp(d.validPackage.create);
40
41 integration('has an empty package name', () {
42 d.dir(appPath, [d.libPubspec("", "1.0.0")]).create();
43 expectValidationError(name);
44 });
45
46 integration('has a package name with an invalid character', () {
47 d.dir(appPath, [d.libPubspec("test-pkg", "1.0.0")]).create();
48 expectValidationError(name);
49 });
50
51 integration('has a package name that begins with a number', () {
52 d.dir(appPath, [d.libPubspec("8ball", "1.0.0")]).create();
53 expectValidationError(name);
54 });
55
56 integration('has a package name that contains upper-case letters', () {
57 d.dir(appPath, [d.libPubspec("TestPkg", "1.0.0")]).create();
58 expectValidationWarning(name);
59 });
60
61 integration('has a package name that is a Dart reserved word', () {
62 d.dir(appPath, [d.libPubspec("final", "1.0.0")]).create();
63 expectValidationError(name);
64 });
65
66 integration('has a library name with an invalid character', () {
67 d.dir(appPath, [
68 d.libPubspec("test_pkg", "1.0.0"),
69 d.dir("lib", [d.file("test-pkg.dart", "int i = 0;")])
70 ]).create();
71 expectValidationWarning(name);
72 });
73
74 integration('has a library name that begins with a number', () {
75 d.dir(appPath, [
76 d.libPubspec("test_pkg", "1.0.0"),
77 d.dir("lib", [d.file("8ball.dart", "int i = 0;")])
78 ]).create();
79 expectValidationWarning(name);
80 });
81
82 integration('has a library name that contains upper-case letters', () {
83 d.dir(appPath, [
84 d.libPubspec("test_pkg", "1.0.0"),
85 d.dir("lib", [d.file("TestPkg.dart", "int i = 0;")])
86 ]).create();
87 expectValidationWarning(name);
88 });
89
90 integration('has a library name that is a Dart reserved word', () {
91 d.dir(appPath, [
92 d.libPubspec("test_pkg", "1.0.0"),
93 d.dir("lib", [d.file("for.dart", "int i = 0;")])
94 ]).create();
95 expectValidationWarning(name);
96 });
97
98 integration('has a single library named differently than the package', () {
99 schedule(() =>
100 deleteEntry(path.join(sandboxDir, appPath, "lib", "test_pkg.dart")));
101 d.dir(appPath, [
102 d.dir("lib", [d.file("best_pkg.dart", "int i = 0;")])
103 ]).create();
104 expectValidationWarning(name);
105 });
106 });
107 }
OLDNEW
« no previous file with comments | « utils/tests/pub/validator/license_test.dart ('k') | utils/tests/pub/validator/pubspec_field_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698