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

Side by Side Diff: sdk/lib/_internal/pub/test/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
16 forBothPubInstallAndUpdate((command) {
17 integration('fails gracefully on a dependency from an unknown source', () {
18 d.appDir([{"bad": "foo"}]).create();
19
20 pubCommand(command, error: new RegExp(
21 "Package 'myapp' depends on 'foo' from unknown source 'bad'.\$"));
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 pubCommand(command, error: new RegExp(
34 "Package 'foo' depends on 'bar' from unknown source 'bad'.\$"));
35 });
36
37 integration('ignores unknown source in lockfile', () {
38 d.dir('foo', [
39 d.libDir('foo'),
40 d.libPubspec('foo', '0.0.1')
41 ]).create();
42
43 // Depend on "foo" from a valid source.
44 d.dir(appPath, [
45 d.pubspec({
46 "name": "myapp",
47 "dependencies": {
48 "foo": {"path": "../foo"}
49 }
50 })
51 ]).create();
52
53 // But lock it to a bad one.
54 d.dir(appPath, [
55 d.file("pubspec.lock", json.stringify({
56 'packages': {
57 'foo': {
58 'version': '0.0.0',
59 'source': 'bad',
60 'description': {
61 'name': 'foo'
62 }
63 }
64 }
65 }))
66 ]).create();
67
68 pubCommand(command);
69
70 // Should update to the new one.
71 d.dir(packagesPath, [
72 d.dir("foo", [
73 d.file("foo.dart", 'main() => "foo";')
74 ])
75 ]).validate();
76 });
77 });
78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698