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

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

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

Powered by Google App Engine
This is Rietveld 408576698