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

Side by Side Diff: sdk/lib/_internal/pub_generated/test/validator/name_test.dart

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

Powered by Google App Engine
This is Rietveld 408576698