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

Side by Side Diff: sdk/lib/_internal/pub/test/install/unknown_source_test.dart

Issue 15701006: Clean up tests that are duplicated between install and update. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 7 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
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS d.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 d.file.
4
5 library pub_tests;
6
7 import 'dart:io';
8 import 'dart:json' as json;
9
10 import '../descriptor.dart' as d;
11 import '../test_pub.dart';
12
13 main() {
14 initConfig();
15 integration('fails gracefully on a dependency from an unknown source', () {
16 d.appDir([{"bad": "foo"}]).create();
17
18 schedulePub(args: ['install'],
19 error: new RegExp("Package 'myapp' depends on 'foo' from unknown "
20 "source 'bad'.\$"),
21 exitCode: 1);
22 });
23
24 integration('fails gracefully on transitive dependency from an unknown '
25 'source', () {
26 d.dir('foo', [
27 d.libDir('foo', 'foo 0.0.1'),
28 d.libPubspec('foo', '0.0.1', deps: [{"bad": "bar"}])
29 ]).create();
30
31 d.appDir([{"path": "../foo"}]).create();
32
33 schedulePub(args: ['install'],
34 error: new RegExp("Package 'foo' depends on 'bar' from unknown "
35 "source 'bad'.\$"),
36 exitCode: 1);
37 });
38
39 integration('ignores unknown source in lockfile', () {
40 d.dir('foo', [
41 d.libDir('foo'),
42 d.libPubspec('foo', '0.0.1')
43 ]).create();
44
45 // Depend on "foo" from a valid source.
46 d.dir(appPath, [
47 d.pubspec({
48 "name": "myapp",
49 "dependencies": {
50 "foo": {"path": "../foo"}
51 }
52 })
53 ]).create();
54
55 // But lock it to a bad one.
56 d.dir(appPath, [
57 d.file("pubspec.lock", json.stringify({
58 'packages': {
59 'foo': {
60 'version': '0.0.0',
61 'source': 'bad',
62 'description': {
63 'name': 'foo'
64 }
65 }
66 }
67 }))
68 ]).create();
69
70 schedulePub(args: ['install'],
71 output: new RegExp(r"Dependencies installed!$"));
72
73 // Should update to the new one.
74 d.dir(packagesPath, [
75 d.dir("foo", [
76 d.file("foo.dart", 'main() => "foo";')
77 ])
78 ]).validate();
79 });
80 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/pub/test/install/pub_install_test.dart ('k') | sdk/lib/_internal/pub/test/pub_install_and_update_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698