OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library('pub_tests'); | 5 #library('pub_tests'); |
6 | 6 |
7 #import('dart:io'); | 7 #import('dart:io'); |
8 | 8 |
9 #import('test_pub.dart'); | 9 #import('test_pub.dart'); |
10 #import('../../../pkg/unittest/unittest.dart'); | 10 #import('../../../pkg/unittest/unittest.dart'); |
11 | 11 |
12 main() { | 12 main() { |
13 test("updates locked Git packages", () { | 13 test("updates locked Git packages", () { |
14 ensureGit(); | 14 ensureGit(); |
15 | 15 |
16 git('foo.git', [ | 16 git('foo.git', [ |
17 file('foo.dart', 'main() => "foo";') | 17 libDir('foo') |
18 ]).scheduleCreate(); | 18 ]).scheduleCreate(); |
19 | 19 |
20 git('bar.git', [ | 20 git('bar.git', [ |
21 file('bar.dart', 'main() => "bar";') | 21 libDir('bar') |
22 ]).scheduleCreate(); | 22 ]).scheduleCreate(); |
23 | 23 |
24 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); | 24 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); |
25 | 25 |
26 schedulePub(args: ['install'], | 26 schedulePub(args: ['install'], |
27 output: const RegExp(@"Dependencies installed!$")); | 27 output: const RegExp(@"Dependencies installed!$")); |
28 | 28 |
29 dir(packagesPath, [ | 29 dir(packagesPath, [ |
30 dir('foo', [ | 30 dir('foo', [ |
31 file('foo.dart', 'main() => "foo";') | 31 file('foo.dart', 'main() => "foo";') |
32 ]), | 32 ]), |
33 dir('bar', [ | 33 dir('bar', [ |
34 file('bar.dart', 'main() => "bar";') | 34 file('bar.dart', 'main() => "bar";') |
35 ]) | 35 ]) |
36 ]).scheduleValidate(); | 36 ]).scheduleValidate(); |
37 | 37 |
38 git('foo.git', [ | 38 git('foo.git', [ |
39 file('foo.dart', 'main() => "foo 2";') | 39 libDir('foo', 'foo 2') |
40 ]).scheduleCommit(); | 40 ]).scheduleCommit(); |
41 | 41 |
42 git('bar.git', [ | 42 git('bar.git', [ |
43 file('bar.dart', 'main() => "bar 2";') | 43 libDir('bar', 'bar 2') |
44 ]).scheduleCommit(); | 44 ]).scheduleCommit(); |
45 | 45 |
46 schedulePub(args: ['update'], | 46 schedulePub(args: ['update'], |
47 output: const RegExp(@"Dependencies updated!$")); | 47 output: const RegExp(@"Dependencies updated!$")); |
48 | 48 |
49 dir(packagesPath, [ | 49 dir(packagesPath, [ |
50 dir('foo', [ | 50 dir('foo', [ |
51 file('foo.dart', 'main() => "foo 2";') | 51 file('foo.dart', 'main() => "foo 2";') |
52 ]), | 52 ]), |
53 dir('bar', [ | 53 dir('bar', [ |
54 file('bar.dart', 'main() => "bar 2";') | 54 file('bar.dart', 'main() => "bar 2";') |
55 ]) | 55 ]) |
56 ]).scheduleValidate(); | 56 ]).scheduleValidate(); |
57 | 57 |
58 run(); | 58 run(); |
59 }); | 59 }); |
60 | 60 |
61 group("with an argument", () { | 61 group("with an argument", () { |
62 test("updates one locked Git package but no others", () { | 62 test("updates one locked Git package but no others", () { |
63 ensureGit(); | 63 ensureGit(); |
64 | 64 |
65 git('foo.git', [ | 65 git('foo.git', [ |
66 file('foo.dart', 'main() => "foo";') | 66 libDir('foo') |
67 ]).scheduleCreate(); | 67 ]).scheduleCreate(); |
68 | 68 |
69 git('bar.git', [ | 69 git('bar.git', [ |
70 file('bar.dart', 'main() => "bar";') | 70 libDir('bar') |
71 ]).scheduleCreate(); | 71 ]).scheduleCreate(); |
72 | 72 |
73 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); | 73 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); |
74 | 74 |
75 schedulePub(args: ['install'], | 75 schedulePub(args: ['install'], |
76 output: const RegExp(@"Dependencies installed!$")); | 76 output: const RegExp(@"Dependencies installed!$")); |
77 | 77 |
78 dir(packagesPath, [ | 78 dir(packagesPath, [ |
79 dir('foo', [ | 79 dir('foo', [ |
80 file('foo.dart', 'main() => "foo";') | 80 file('foo.dart', 'main() => "foo";') |
81 ]), | 81 ]), |
82 dir('bar', [ | 82 dir('bar', [ |
83 file('bar.dart', 'main() => "bar";') | 83 file('bar.dart', 'main() => "bar";') |
84 ]) | 84 ]) |
85 ]).scheduleValidate(); | 85 ]).scheduleValidate(); |
86 | 86 |
87 git('foo.git', [ | 87 git('foo.git', [ |
88 file('foo.dart', 'main() => "foo 2";') | 88 libDir('foo', 'foo 2') |
89 ]).scheduleCommit(); | 89 ]).scheduleCommit(); |
90 | 90 |
91 git('bar.git', [ | 91 git('bar.git', [ |
92 file('bar.dart', 'main() => "bar 2";') | 92 libDir('bar', 'bar 2') |
93 ]).scheduleCommit(); | 93 ]).scheduleCommit(); |
94 | 94 |
95 schedulePub(args: ['update', 'foo'], | 95 schedulePub(args: ['update', 'foo'], |
96 output: const RegExp(@"Dependencies updated!$")); | 96 output: const RegExp(@"Dependencies updated!$")); |
97 | 97 |
98 dir(packagesPath, [ | 98 dir(packagesPath, [ |
99 dir('foo', [ | 99 dir('foo', [ |
100 file('foo.dart', 'main() => "foo 2";') | 100 file('foo.dart', 'main() => "foo 2";') |
101 ]), | 101 ]), |
102 dir('bar', [ | 102 dir('bar', [ |
103 file('bar.dart', 'main() => "bar";') | 103 file('bar.dart', 'main() => "bar";') |
104 ]) | 104 ]) |
105 ]).scheduleValidate(); | 105 ]).scheduleValidate(); |
106 | 106 |
107 run(); | 107 run(); |
108 }); | 108 }); |
109 | 109 |
110 test("doesn't update one locked Git package's dependencies if it's not " | 110 test("doesn't update one locked Git package's dependencies if it's not " |
111 "necessary", () { | 111 "necessary", () { |
112 ensureGit(); | 112 ensureGit(); |
113 | 113 |
114 git('foo.git', [ | 114 git('foo.git', [ |
115 file('foo.dart', 'main() => "foo";'), | 115 libDir('foo'), |
116 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) | 116 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) |
117 ]).scheduleCreate(); | 117 ]).scheduleCreate(); |
118 | 118 |
119 git('foo-dep.git', [ | 119 git('foo-dep.git', [ |
120 file('foo-dep.dart', 'main() => "foo-dep";'), | 120 libDir('foo-dep') |
121 ]).scheduleCreate(); | 121 ]).scheduleCreate(); |
122 | 122 |
123 appDir([{"git": "../foo.git"}]).scheduleCreate(); | 123 appDir([{"git": "../foo.git"}]).scheduleCreate(); |
124 | 124 |
125 schedulePub(args: ['install'], | 125 schedulePub(args: ['install'], |
126 output: const RegExp(@"Dependencies installed!$")); | 126 output: const RegExp(@"Dependencies installed!$")); |
127 | 127 |
128 dir(packagesPath, [ | 128 dir(packagesPath, [ |
129 dir('foo', [ | 129 dir('foo', [ |
130 file('foo.dart', 'main() => "foo";'), | 130 file('foo.dart', 'main() => "foo";') |
131 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) | |
132 ]), | 131 ]), |
133 dir('foo-dep', [ | 132 dir('foo-dep', [ |
134 file('foo-dep.dart', 'main() => "foo-dep";') | 133 file('foo-dep.dart', 'main() => "foo-dep";') |
135 ]) | 134 ]) |
136 ]).scheduleValidate(); | 135 ]).scheduleValidate(); |
137 | 136 |
138 git('foo.git', [ | 137 git('foo.git', [ |
139 file('foo.dart', 'main() => "foo 2";'), | 138 libDir('foo', 'foo 2'), |
140 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) | 139 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) |
141 ]).scheduleCreate(); | 140 ]).scheduleCreate(); |
142 | 141 |
143 git('foo-dep.git', [ | 142 git('foo-dep.git', [ |
144 file('foo-dep.dart', 'main() => "foo-dep 2";') | 143 libDir('foo-dep', 'foo-dep 2') |
145 ]).scheduleCommit(); | 144 ]).scheduleCommit(); |
146 | 145 |
147 schedulePub(args: ['update', 'foo'], | 146 schedulePub(args: ['update', 'foo'], |
148 output: const RegExp(@"Dependencies updated!$")); | 147 output: const RegExp(@"Dependencies updated!$")); |
149 | 148 |
150 dir(packagesPath, [ | 149 dir(packagesPath, [ |
151 dir('foo', [ | 150 dir('foo', [ |
152 file('foo.dart', 'main() => "foo 2";'), | 151 file('foo.dart', 'main() => "foo 2";') |
153 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) | |
154 ]), | 152 ]), |
155 dir('foo-dep', [ | 153 dir('foo-dep', [ |
156 file('foo-dep.dart', 'main() => "foo-dep";') | 154 file('foo-dep.dart', 'main() => "foo-dep";') |
157 ]), | 155 ]), |
158 ]).scheduleValidate(); | 156 ]).scheduleValidate(); |
159 | 157 |
160 run(); | 158 run(); |
161 }); | 159 }); |
162 }); | 160 }); |
163 } | 161 } |
OLD | NEW |