blob: c61502aabeeab81732def91c03fe0d404b06a5d2 [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/unittest.dart';
main() {
test('checks out and updates a package from Git', () {
ensureGit();
git('foo.git', [
libDir('foo'),
libPubspec('foo', '1.0.0')
]).scheduleCreate();
appDir([{"git": "../foo.git"}]).scheduleCreate();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
dir(cachePath, [
dir('git', [
dir('cache', [gitPackageRepoCacheDir('foo')]),
gitPackageRevisionCacheDir('foo')
])
]).scheduleValidate();
dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo";')
])
]).scheduleValidate();
// TODO(nweiz): remove this once we support pub update
dir(packagesPath).scheduleDelete();
file('$appPath/pubspec.lock', '').scheduleDelete();
git('foo.git', [
libDir('foo', 'foo 2'),
libPubspec('foo', '1.0.0')
]).scheduleCommit();
schedulePub(args: ['install'],
output: const RegExp(r"Dependencies installed!$"));
// When we download a new version of the git package, we should re-use the
// git/cache directory but create a new git/ directory.
dir(cachePath, [
dir('git', [
dir('cache', [gitPackageRepoCacheDir('foo')]),
gitPackageRevisionCacheDir('foo'),
gitPackageRevisionCacheDir('foo', 2)
])
]).scheduleValidate();
dir(packagesPath, [
dir('foo', [
file('foo.dart', 'main() => "foo 2";')
])
]).scheduleValidate();
run();
});
}