blob: a1e1bc7a68973fd4c1273c5e632ffc4cd8419300 [file] [log] [blame]
// Copyright (c) 2012, 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.
library pub_tests;
import 'dart:io';
import 'test_pub.dart';
import '../../../pkg/unittest/lib/unittest.dart';
final USAGE_STRING = """
Pub is a package manager for Dart.
Usage: pub command [arguments]
Global options:
-h, --help Prints this usage information
--version Prints the version of Pub
--[no-]trace Prints a stack trace when an error occurs
The commands are:
help display help information for Pub
install install the current package's dependencies
update update the current package's dependencies to the latest versions
version print Pub version
Use "pub help [command]" for more information about a command.
""";
final VERSION_STRING = '''
Pub 0.0.0
''';
main() {
test('running pub with no command displays usage', () =>
runPub(args: [], output: USAGE_STRING));
test('running pub with just --help displays usage', () =>
runPub(args: ['--help'], output: USAGE_STRING));
test('running pub with just -h displays usage', () =>
runPub(args: ['-h'], output: USAGE_STRING));
test('running pub with just --version displays version', () =>
runPub(args: ['--version'], output: VERSION_STRING));
group('an unknown command', () {
test('displays an error message', () {
runPub(args: ['quylthulg'],
error: '''
Unknown command "quylthulg".
Run "pub help" to see available commands.
''',
exitCode: 64);
});
});
test('displays the current version', () =>
runPub(args: ['version'], output: VERSION_STRING));
}