| Index: test/get/package_name_test.dart
|
| diff --git a/test/get/package_name_test.dart b/test/get/package_name_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..85955a2c263ae5e52fc4bf0ad6fe147a57c8d9ac
|
| --- /dev/null
|
| +++ b/test/get/package_name_test.dart
|
| @@ -0,0 +1,70 @@
|
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +import 'package:scheduled_test/scheduled_test.dart';
|
| +
|
| +import 'package:pub/src/exit_codes.dart' as exit_codes;
|
| +
|
| +import '../descriptor.dart' as d;
|
| +import '../test_pub.dart';
|
| +
|
| +main() {
|
| + integration("pub get fails with a non-identifier name", () {
|
| + d.dir(appPath, [
|
| + d.pubspec({
|
| + "name": "invalid package name",
|
| + "version": "1.0.0"
|
| + })
|
| + ]).create();
|
| +
|
| + pubGet(
|
| + error: contains('"name" field must be a valid Dart identifier.'),
|
| + exitCode: exit_codes.DATA);
|
| +
|
| + d.dir(appPath, [
|
| + // The lockfile should not be created.
|
| + d.nothing("pubspec.lock"),
|
| + // The "packages" directory should not have been generated.
|
| + d.nothing("packages"),
|
| + // The ".packages" file should not have been created.
|
| + d.nothing(".packages"),
|
| + ]).validate();
|
| + });
|
| +
|
| + integration("pub get fails with a reserved word name", () {
|
| + d.dir(appPath, [
|
| + d.pubspec({
|
| + "name": "return",
|
| + "version": "1.0.0"
|
| + })
|
| + ]).create();
|
| +
|
| + pubGet(
|
| + error: contains('"name" field may not be a Dart reserved word.'),
|
| + exitCode: exit_codes.DATA);
|
| +
|
| + d.dir(appPath, [
|
| + // The lockfile should not be created.
|
| + d.nothing("pubspec.lock"),
|
| + // The "packages" directory should not have been generated.
|
| + d.nothing("packages"),
|
| + // The ".packages" file should not have been created.
|
| + d.nothing(".packages"),
|
| + ]).validate();
|
| + });
|
| +
|
| + integration("pub get allows a name with dotted identifiers", () {
|
| + d.dir(appPath, [
|
| + d.pubspec({
|
| + "name": "foo.bar.baz",
|
| + "version": "1.0.0"
|
| + }),
|
| + d.libDir("foo.bar.baz", "foo.bar.baz 1.0.0")
|
| + ]).create();
|
| +
|
| + pubGet();
|
| +
|
| + d.packagesDir({"foo.bar.baz": "1.0.0"}).validate();
|
| + });
|
| +}
|
|
|