| 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 libDir('foo') | 17 libDir('foo'), |
| 18 libPubspec('foo', '1.0.0') |
| 18 ]).scheduleCreate(); | 19 ]).scheduleCreate(); |
| 19 | 20 |
| 20 git('bar.git', [ | 21 git('bar.git', [ |
| 21 libDir('bar') | 22 libDir('bar'), |
| 23 libPubspec('bar', '1.0.0') |
| 22 ]).scheduleCreate(); | 24 ]).scheduleCreate(); |
| 23 | 25 |
| 24 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); | 26 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); |
| 25 | 27 |
| 26 schedulePub(args: ['install'], | 28 schedulePub(args: ['install'], |
| 27 output: const RegExp(@"Dependencies installed!$")); | 29 output: const RegExp(@"Dependencies installed!$")); |
| 28 | 30 |
| 29 dir(packagesPath, [ | 31 dir(packagesPath, [ |
| 30 dir('foo', [ | 32 dir('foo', [ |
| 31 file('foo.dart', 'main() => "foo";') | 33 file('foo.dart', 'main() => "foo";') |
| 32 ]), | 34 ]), |
| 33 dir('bar', [ | 35 dir('bar', [ |
| 34 file('bar.dart', 'main() => "bar";') | 36 file('bar.dart', 'main() => "bar";') |
| 35 ]) | 37 ]) |
| 36 ]).scheduleValidate(); | 38 ]).scheduleValidate(); |
| 37 | 39 |
| 38 git('foo.git', [ | 40 git('foo.git', [ |
| 39 libDir('foo', 'foo 2') | 41 libDir('foo', 'foo 2'), |
| 42 libPubspec('foo', '1.0.0') |
| 40 ]).scheduleCommit(); | 43 ]).scheduleCommit(); |
| 41 | 44 |
| 42 git('bar.git', [ | 45 git('bar.git', [ |
| 43 libDir('bar', 'bar 2') | 46 libDir('bar', 'bar 2'), |
| 47 libPubspec('bar', '1.0.0') |
| 44 ]).scheduleCommit(); | 48 ]).scheduleCommit(); |
| 45 | 49 |
| 46 schedulePub(args: ['update'], | 50 schedulePub(args: ['update'], |
| 47 output: const RegExp(@"Dependencies updated!$")); | 51 output: const RegExp(@"Dependencies updated!$")); |
| 48 | 52 |
| 49 dir(packagesPath, [ | 53 dir(packagesPath, [ |
| 50 dir('foo', [ | 54 dir('foo', [ |
| 51 file('foo.dart', 'main() => "foo 2";') | 55 file('foo.dart', 'main() => "foo 2";') |
| 52 ]), | 56 ]), |
| 53 dir('bar', [ | 57 dir('bar', [ |
| 54 file('bar.dart', 'main() => "bar 2";') | 58 file('bar.dart', 'main() => "bar 2";') |
| 55 ]) | 59 ]) |
| 56 ]).scheduleValidate(); | 60 ]).scheduleValidate(); |
| 57 | 61 |
| 58 run(); | 62 run(); |
| 59 }); | 63 }); |
| 60 | 64 |
| 61 group("with an argument", () { | 65 group("with an argument", () { |
| 62 test("updates one locked Git package but no others", () { | 66 test("updates one locked Git package but no others", () { |
| 63 ensureGit(); | 67 ensureGit(); |
| 64 | 68 |
| 65 git('foo.git', [ | 69 git('foo.git', [ |
| 66 libDir('foo') | 70 libDir('foo'), |
| 71 libPubspec('foo', '1.0.0') |
| 67 ]).scheduleCreate(); | 72 ]).scheduleCreate(); |
| 68 | 73 |
| 69 git('bar.git', [ | 74 git('bar.git', [ |
| 70 libDir('bar') | 75 libDir('bar'), |
| 76 libPubspec('bar', '1.0.0') |
| 71 ]).scheduleCreate(); | 77 ]).scheduleCreate(); |
| 72 | 78 |
| 73 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); | 79 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); |
| 74 | 80 |
| 75 schedulePub(args: ['install'], | 81 schedulePub(args: ['install'], |
| 76 output: const RegExp(@"Dependencies installed!$")); | 82 output: const RegExp(@"Dependencies installed!$")); |
| 77 | 83 |
| 78 dir(packagesPath, [ | 84 dir(packagesPath, [ |
| 79 dir('foo', [ | 85 dir('foo', [ |
| 80 file('foo.dart', 'main() => "foo";') | 86 file('foo.dart', 'main() => "foo";') |
| 81 ]), | 87 ]), |
| 82 dir('bar', [ | 88 dir('bar', [ |
| 83 file('bar.dart', 'main() => "bar";') | 89 file('bar.dart', 'main() => "bar";') |
| 84 ]) | 90 ]) |
| 85 ]).scheduleValidate(); | 91 ]).scheduleValidate(); |
| 86 | 92 |
| 87 git('foo.git', [ | 93 git('foo.git', [ |
| 88 libDir('foo', 'foo 2') | 94 libDir('foo', 'foo 2'), |
| 95 libPubspec('foo', '1.0.0') |
| 89 ]).scheduleCommit(); | 96 ]).scheduleCommit(); |
| 90 | 97 |
| 91 git('bar.git', [ | 98 git('bar.git', [ |
| 92 libDir('bar', 'bar 2') | 99 libDir('bar', 'bar 2'), |
| 100 libPubspec('bar', '1.0.0') |
| 93 ]).scheduleCommit(); | 101 ]).scheduleCommit(); |
| 94 | 102 |
| 95 schedulePub(args: ['update', 'foo'], | 103 schedulePub(args: ['update', 'foo'], |
| 96 output: const RegExp(@"Dependencies updated!$")); | 104 output: const RegExp(@"Dependencies updated!$")); |
| 97 | 105 |
| 98 dir(packagesPath, [ | 106 dir(packagesPath, [ |
| 99 dir('foo', [ | 107 dir('foo', [ |
| 100 file('foo.dart', 'main() => "foo 2";') | 108 file('foo.dart', 'main() => "foo 2";') |
| 101 ]), | 109 ]), |
| 102 dir('bar', [ | 110 dir('bar', [ |
| 103 file('bar.dart', 'main() => "bar";') | 111 file('bar.dart', 'main() => "bar";') |
| 104 ]) | 112 ]) |
| 105 ]).scheduleValidate(); | 113 ]).scheduleValidate(); |
| 106 | 114 |
| 107 run(); | 115 run(); |
| 108 }); | 116 }); |
| 109 | 117 |
| 110 test("doesn't update one locked Git package's dependencies if it's not " | 118 test("doesn't update one locked Git package's dependencies if it's not " |
| 111 "necessary", () { | 119 "necessary", () { |
| 112 ensureGit(); | 120 ensureGit(); |
| 113 | 121 |
| 114 git('foo.git', [ | 122 git('foo.git', [ |
| 115 libDir('foo'), | 123 libDir('foo'), |
| 116 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) | 124 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) |
| 117 ]).scheduleCreate(); | 125 ]).scheduleCreate(); |
| 118 | 126 |
| 119 git('foo-dep.git', [ | 127 git('foo-dep.git', [ |
| 120 libDir('foo-dep') | 128 libDir('foo-dep'), |
| 129 libPubspec('foo-dep', '1.0.0') |
| 121 ]).scheduleCreate(); | 130 ]).scheduleCreate(); |
| 122 | 131 |
| 123 appDir([{"git": "../foo.git"}]).scheduleCreate(); | 132 appDir([{"git": "../foo.git"}]).scheduleCreate(); |
| 124 | 133 |
| 125 schedulePub(args: ['install'], | 134 schedulePub(args: ['install'], |
| 126 output: const RegExp(@"Dependencies installed!$")); | 135 output: const RegExp(@"Dependencies installed!$")); |
| 127 | 136 |
| 128 dir(packagesPath, [ | 137 dir(packagesPath, [ |
| 129 dir('foo', [ | 138 dir('foo', [ |
| 130 file('foo.dart', 'main() => "foo";') | 139 file('foo.dart', 'main() => "foo";') |
| 131 ]), | 140 ]), |
| 132 dir('foo-dep', [ | 141 dir('foo-dep', [ |
| 133 file('foo-dep.dart', 'main() => "foo-dep";') | 142 file('foo-dep.dart', 'main() => "foo-dep";') |
| 134 ]) | 143 ]) |
| 135 ]).scheduleValidate(); | 144 ]).scheduleValidate(); |
| 136 | 145 |
| 137 git('foo.git', [ | 146 git('foo.git', [ |
| 138 libDir('foo', 'foo 2'), | 147 libDir('foo', 'foo 2'), |
| 139 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) | 148 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) |
| 140 ]).scheduleCreate(); | 149 ]).scheduleCreate(); |
| 141 | 150 |
| 142 git('foo-dep.git', [ | 151 git('foo-dep.git', [ |
| 143 libDir('foo-dep', 'foo-dep 2') | 152 libDir('foo-dep', 'foo-dep 2'), |
| 153 libPubspec('foo-dep', '1.0.0') |
| 144 ]).scheduleCommit(); | 154 ]).scheduleCommit(); |
| 145 | 155 |
| 146 schedulePub(args: ['update', 'foo'], | 156 schedulePub(args: ['update', 'foo'], |
| 147 output: const RegExp(@"Dependencies updated!$")); | 157 output: const RegExp(@"Dependencies updated!$")); |
| 148 | 158 |
| 149 dir(packagesPath, [ | 159 dir(packagesPath, [ |
| 150 dir('foo', [ | 160 dir('foo', [ |
| 151 file('foo.dart', 'main() => "foo 2";') | 161 file('foo.dart', 'main() => "foo 2";') |
| 152 ]), | 162 ]), |
| 153 dir('foo-dep', [ | 163 dir('foo-dep', [ |
| 154 file('foo-dep.dart', 'main() => "foo-dep";') | 164 file('foo-dep.dart', 'main() => "foo-dep";') |
| 155 ]), | 165 ]), |
| 156 ]).scheduleValidate(); | 166 ]).scheduleValidate(); |
| 157 | 167 |
| 158 run(); | 168 run(); |
| 159 }); | 169 }); |
| 160 }); | 170 }); |
| 161 } | 171 } |
| OLD | NEW |