OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:path/path.dart' as path; | 5 import 'package:path/path.dart' as path; |
6 import 'package:pub/src/entrypoint.dart'; | 6 import 'package:pub/src/entrypoint.dart'; |
7 import 'package:pub/src/io.dart'; | 7 import 'package:pub/src/io.dart'; |
8 import 'package:pub/src/validator.dart'; | 8 import 'package:pub/src/validator.dart'; |
9 import 'package:pub/src/validator/name.dart'; | 9 import 'package:pub/src/validator/name.dart'; |
10 import 'package:scheduled_test/scheduled_test.dart'; | 10 import 'package:scheduled_test/scheduled_test.dart'; |
(...skipping 28 matching lines...) Expand all Loading... |
39 d.file("_test_pkg.dart", "int i = 1;") | 39 d.file("_test_pkg.dart", "int i = 1;") |
40 ]) | 40 ]) |
41 ]).create(); | 41 ]).create(); |
42 expectNoValidationError(name); | 42 expectNoValidationError(name); |
43 }); | 43 }); |
44 }); | 44 }); |
45 | 45 |
46 group('should consider a package invalid if it', () { | 46 group('should consider a package invalid if it', () { |
47 setUp(d.validPackage.create); | 47 setUp(d.validPackage.create); |
48 | 48 |
49 integration('has an empty package name', () { | |
50 d.dir(appPath, [d.libPubspec("", "1.0.0")]).create(); | |
51 expectValidationError(name); | |
52 }); | |
53 | |
54 integration('has a package name with an invalid character', () { | |
55 d.dir(appPath, [d.libPubspec("test-pkg", "1.0.0")]).create(); | |
56 expectValidationError(name); | |
57 }); | |
58 | |
59 integration('has a package name that begins with a number', () { | |
60 d.dir(appPath, [d.libPubspec("8ball", "1.0.0")]).create(); | |
61 expectValidationError(name); | |
62 }); | |
63 | |
64 integration('has a package name that contains upper-case letters', () { | 49 integration('has a package name that contains upper-case letters', () { |
65 d.dir(appPath, [d.libPubspec("TestPkg", "1.0.0")]).create(); | 50 d.dir(appPath, [d.libPubspec("TestPkg", "1.0.0")]).create(); |
66 expectValidationWarning(name); | 51 expectValidationWarning(name); |
67 }); | 52 }); |
68 | 53 |
69 integration('has a package name that is a Dart reserved word', () { | |
70 d.dir(appPath, [d.libPubspec("final", "1.0.0")]).create(); | |
71 expectValidationError(name); | |
72 }); | |
73 | |
74 integration('has a library name with an invalid character', () { | 54 integration('has a library name with an invalid character', () { |
75 d.dir(appPath, [ | 55 d.dir(appPath, [ |
76 d.libPubspec("test_pkg", "1.0.0"), | 56 d.libPubspec("test_pkg", "1.0.0"), |
77 d.dir("lib", [d.file("test-pkg.dart", "int i = 0;")]) | 57 d.dir("lib", [d.file("test-pkg.dart", "int i = 0;")]) |
78 ]).create(); | 58 ]).create(); |
79 expectValidationWarning(name); | 59 expectValidationWarning(name); |
80 }); | 60 }); |
81 | 61 |
82 integration('has a library name that begins with a number', () { | 62 integration('has a library name that begins with a number', () { |
83 d.dir(appPath, [ | 63 d.dir(appPath, [ |
(...skipping 22 matching lines...) Expand all Loading... |
106 integration('has a single library named differently than the package', () { | 86 integration('has a single library named differently than the package', () { |
107 schedule(() => | 87 schedule(() => |
108 deleteEntry(path.join(sandboxDir, appPath, "lib", "test_pkg.dart"))); | 88 deleteEntry(path.join(sandboxDir, appPath, "lib", "test_pkg.dart"))); |
109 d.dir(appPath, [ | 89 d.dir(appPath, [ |
110 d.dir("lib", [d.file("best_pkg.dart", "int i = 0;")]) | 90 d.dir("lib", [d.file("best_pkg.dart", "int i = 0;")]) |
111 ]).create(); | 91 ]).create(); |
112 expectValidationWarning(name); | 92 expectValidationWarning(name); |
113 }); | 93 }); |
114 }); | 94 }); |
115 } | 95 } |
OLD | NEW |