| 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 libPubspec('foo', '1.0.0') |
| 19 ]).scheduleCreate(); | 19 ]).scheduleCreate(); |
| 20 | 20 |
| 21 git('bar.git', [ | 21 git('bar.git', [ |
| 22 libDir('bar'), | 22 libDir('bar'), |
| 23 libPubspec('bar', '1.0.0') | 23 libPubspec('bar', '1.0.0') |
| 24 ]).scheduleCreate(); | 24 ]).scheduleCreate(); |
| 25 | 25 |
| 26 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); | 26 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); |
| 27 | 27 |
| 28 schedulePub(args: ['install'], | 28 schedulePub(args: ['install'], |
| 29 output: const RegExp(@"Dependencies installed!$")); | 29 output: const RegExp(r"Dependencies installed!$")); |
| 30 | 30 |
| 31 dir(packagesPath, [ | 31 dir(packagesPath, [ |
| 32 dir('foo', [ | 32 dir('foo', [ |
| 33 file('foo.dart', 'main() => "foo";') | 33 file('foo.dart', 'main() => "foo";') |
| 34 ]), | 34 ]), |
| 35 dir('bar', [ | 35 dir('bar', [ |
| 36 file('bar.dart', 'main() => "bar";') | 36 file('bar.dart', 'main() => "bar";') |
| 37 ]) | 37 ]) |
| 38 ]).scheduleValidate(); | 38 ]).scheduleValidate(); |
| 39 | 39 |
| 40 git('foo.git', [ | 40 git('foo.git', [ |
| 41 libDir('foo', 'foo 2'), | 41 libDir('foo', 'foo 2'), |
| 42 libPubspec('foo', '1.0.0') | 42 libPubspec('foo', '1.0.0') |
| 43 ]).scheduleCommit(); | 43 ]).scheduleCommit(); |
| 44 | 44 |
| 45 git('bar.git', [ | 45 git('bar.git', [ |
| 46 libDir('bar', 'bar 2'), | 46 libDir('bar', 'bar 2'), |
| 47 libPubspec('bar', '1.0.0') | 47 libPubspec('bar', '1.0.0') |
| 48 ]).scheduleCommit(); | 48 ]).scheduleCommit(); |
| 49 | 49 |
| 50 schedulePub(args: ['update'], | 50 schedulePub(args: ['update'], |
| 51 output: const RegExp(@"Dependencies updated!$")); | 51 output: const RegExp(r"Dependencies updated!$")); |
| 52 | 52 |
| 53 dir(packagesPath, [ | 53 dir(packagesPath, [ |
| 54 dir('foo', [ | 54 dir('foo', [ |
| 55 file('foo.dart', 'main() => "foo 2";') | 55 file('foo.dart', 'main() => "foo 2";') |
| 56 ]), | 56 ]), |
| 57 dir('bar', [ | 57 dir('bar', [ |
| 58 file('bar.dart', 'main() => "bar 2";') | 58 file('bar.dart', 'main() => "bar 2";') |
| 59 ]) | 59 ]) |
| 60 ]).scheduleValidate(); | 60 ]).scheduleValidate(); |
| 61 | 61 |
| 62 run(); | 62 run(); |
| 63 }); | 63 }); |
| 64 | 64 |
| 65 test("updates Git packages to an incompatible pubspec", () { | 65 test("updates Git packages to an incompatible pubspec", () { |
| 66 ensureGit(); | 66 ensureGit(); |
| 67 | 67 |
| 68 git('foo.git', [ | 68 git('foo.git', [ |
| 69 libDir('foo'), | 69 libDir('foo'), |
| 70 libPubspec('foo', '1.0.0') | 70 libPubspec('foo', '1.0.0') |
| 71 ]).scheduleCreate(); | 71 ]).scheduleCreate(); |
| 72 | 72 |
| 73 appDir([{"git": "../foo.git"}]).scheduleCreate(); | 73 appDir([{"git": "../foo.git"}]).scheduleCreate(); |
| 74 | 74 |
| 75 schedulePub(args: ['install'], | 75 schedulePub(args: ['install'], |
| 76 output: const RegExp(@"Dependencies installed!$")); | 76 output: const RegExp(r"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 ]).scheduleValidate(); | 82 ]).scheduleValidate(); |
| 83 | 83 |
| 84 git('foo.git', [ | 84 git('foo.git', [ |
| 85 libDir('zoo'), | 85 libDir('zoo'), |
| 86 libPubspec('zoo', '1.0.0') | 86 libPubspec('zoo', '1.0.0') |
| 87 ]).scheduleCommit(); | 87 ]).scheduleCommit(); |
| 88 | 88 |
| 89 schedulePub(args: ['update'], | 89 schedulePub(args: ['update'], |
| 90 error: const RegExp(@'The name you specified for your dependency, ' | 90 error: const RegExp(r'The name you specified for your dependency, ' |
| 91 @'"foo", doesn' @"'" @'t match the name "zoo" in its pubspec.'), | 91 r'"foo", doesn' "'" r't match the name "zoo" in its pubspec.'), |
| 92 exitCode: 1); | 92 exitCode: 1); |
| 93 | 93 |
| 94 dir(packagesPath, [ | 94 dir(packagesPath, [ |
| 95 dir('foo', [ | 95 dir('foo', [ |
| 96 file('foo.dart', 'main() => "foo";') | 96 file('foo.dart', 'main() => "foo";') |
| 97 ]) | 97 ]) |
| 98 ]).scheduleValidate(); | 98 ]).scheduleValidate(); |
| 99 | 99 |
| 100 run(); | 100 run(); |
| 101 }); | 101 }); |
| 102 | 102 |
| 103 solo_test("updates Git packages to a nonexistent pubspec", () { | 103 solo_test("updates Git packages to a nonexistent pubspec", () { |
| 104 ensureGit(); | 104 ensureGit(); |
| 105 | 105 |
| 106 var repo = git('foo.git', [ | 106 var repo = git('foo.git', [ |
| 107 libDir('foo'), | 107 libDir('foo'), |
| 108 libPubspec('foo', '1.0.0') | 108 libPubspec('foo', '1.0.0') |
| 109 ]); | 109 ]); |
| 110 repo.scheduleCreate(); | 110 repo.scheduleCreate(); |
| 111 | 111 |
| 112 appDir([{"git": "../foo.git"}]).scheduleCreate(); | 112 appDir([{"git": "../foo.git"}]).scheduleCreate(); |
| 113 | 113 |
| 114 schedulePub(args: ['install'], | 114 schedulePub(args: ['install'], |
| 115 output: const RegExp(@"Dependencies installed!$")); | 115 output: const RegExp(r"Dependencies installed!$")); |
| 116 | 116 |
| 117 dir(packagesPath, [ | 117 dir(packagesPath, [ |
| 118 dir('foo', [ | 118 dir('foo', [ |
| 119 file('foo.dart', 'main() => "foo";') | 119 file('foo.dart', 'main() => "foo";') |
| 120 ]) | 120 ]) |
| 121 ]).scheduleValidate(); | 121 ]).scheduleValidate(); |
| 122 | 122 |
| 123 repo.scheduleGit(['rm', 'pubspec.yaml']); | 123 repo.scheduleGit(['rm', 'pubspec.yaml']); |
| 124 repo.scheduleGit(['commit', '-m', 'delete']); | 124 repo.scheduleGit(['commit', '-m', 'delete']); |
| 125 | 125 |
| 126 schedulePub(args: ['update'], | 126 schedulePub(args: ['update'], |
| 127 error: const RegExp(@'Package "foo" doesn' @"'" @'t have a ' | 127 error: const RegExp(r'Package "foo" doesn' "'" r't have a ' |
| 128 @'pubspec.yaml file.'), | 128 r'pubspec.yaml file.'), |
| 129 exitCode: 1); | 129 exitCode: 1); |
| 130 | 130 |
| 131 dir(packagesPath, [ | 131 dir(packagesPath, [ |
| 132 dir('foo', [ | 132 dir('foo', [ |
| 133 file('foo.dart', 'main() => "foo";') | 133 file('foo.dart', 'main() => "foo";') |
| 134 ]) | 134 ]) |
| 135 ]).scheduleValidate(); | 135 ]).scheduleValidate(); |
| 136 | 136 |
| 137 run(); | 137 run(); |
| 138 }); | 138 }); |
| 139 | 139 |
| 140 group("with an argument", () { | 140 group("with an argument", () { |
| 141 test("updates one locked Git package but no others", () { | 141 test("updates one locked Git package but no others", () { |
| 142 ensureGit(); | 142 ensureGit(); |
| 143 | 143 |
| 144 git('foo.git', [ | 144 git('foo.git', [ |
| 145 libDir('foo'), | 145 libDir('foo'), |
| 146 libPubspec('foo', '1.0.0') | 146 libPubspec('foo', '1.0.0') |
| 147 ]).scheduleCreate(); | 147 ]).scheduleCreate(); |
| 148 | 148 |
| 149 git('bar.git', [ | 149 git('bar.git', [ |
| 150 libDir('bar'), | 150 libDir('bar'), |
| 151 libPubspec('bar', '1.0.0') | 151 libPubspec('bar', '1.0.0') |
| 152 ]).scheduleCreate(); | 152 ]).scheduleCreate(); |
| 153 | 153 |
| 154 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); | 154 appDir([{"git": "../foo.git"}, {"git": "../bar.git"}]).scheduleCreate(); |
| 155 | 155 |
| 156 schedulePub(args: ['install'], | 156 schedulePub(args: ['install'], |
| 157 output: const RegExp(@"Dependencies installed!$")); | 157 output: const RegExp(r"Dependencies installed!$")); |
| 158 | 158 |
| 159 dir(packagesPath, [ | 159 dir(packagesPath, [ |
| 160 dir('foo', [ | 160 dir('foo', [ |
| 161 file('foo.dart', 'main() => "foo";') | 161 file('foo.dart', 'main() => "foo";') |
| 162 ]), | 162 ]), |
| 163 dir('bar', [ | 163 dir('bar', [ |
| 164 file('bar.dart', 'main() => "bar";') | 164 file('bar.dart', 'main() => "bar";') |
| 165 ]) | 165 ]) |
| 166 ]).scheduleValidate(); | 166 ]).scheduleValidate(); |
| 167 | 167 |
| 168 git('foo.git', [ | 168 git('foo.git', [ |
| 169 libDir('foo', 'foo 2'), | 169 libDir('foo', 'foo 2'), |
| 170 libPubspec('foo', '1.0.0') | 170 libPubspec('foo', '1.0.0') |
| 171 ]).scheduleCommit(); | 171 ]).scheduleCommit(); |
| 172 | 172 |
| 173 git('bar.git', [ | 173 git('bar.git', [ |
| 174 libDir('bar', 'bar 2'), | 174 libDir('bar', 'bar 2'), |
| 175 libPubspec('bar', '1.0.0') | 175 libPubspec('bar', '1.0.0') |
| 176 ]).scheduleCommit(); | 176 ]).scheduleCommit(); |
| 177 | 177 |
| 178 schedulePub(args: ['update', 'foo'], | 178 schedulePub(args: ['update', 'foo'], |
| 179 output: const RegExp(@"Dependencies updated!$")); | 179 output: const RegExp(r"Dependencies updated!$")); |
| 180 | 180 |
| 181 dir(packagesPath, [ | 181 dir(packagesPath, [ |
| 182 dir('foo', [ | 182 dir('foo', [ |
| 183 file('foo.dart', 'main() => "foo 2";') | 183 file('foo.dart', 'main() => "foo 2";') |
| 184 ]), | 184 ]), |
| 185 dir('bar', [ | 185 dir('bar', [ |
| 186 file('bar.dart', 'main() => "bar";') | 186 file('bar.dart', 'main() => "bar";') |
| 187 ]) | 187 ]) |
| 188 ]).scheduleValidate(); | 188 ]).scheduleValidate(); |
| 189 | 189 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 200 ]).scheduleCreate(); | 200 ]).scheduleCreate(); |
| 201 | 201 |
| 202 git('foo-dep.git', [ | 202 git('foo-dep.git', [ |
| 203 libDir('foo-dep'), | 203 libDir('foo-dep'), |
| 204 libPubspec('foo-dep', '1.0.0') | 204 libPubspec('foo-dep', '1.0.0') |
| 205 ]).scheduleCreate(); | 205 ]).scheduleCreate(); |
| 206 | 206 |
| 207 appDir([{"git": "../foo.git"}]).scheduleCreate(); | 207 appDir([{"git": "../foo.git"}]).scheduleCreate(); |
| 208 | 208 |
| 209 schedulePub(args: ['install'], | 209 schedulePub(args: ['install'], |
| 210 output: const RegExp(@"Dependencies installed!$")); | 210 output: const RegExp(r"Dependencies installed!$")); |
| 211 | 211 |
| 212 dir(packagesPath, [ | 212 dir(packagesPath, [ |
| 213 dir('foo', [ | 213 dir('foo', [ |
| 214 file('foo.dart', 'main() => "foo";') | 214 file('foo.dart', 'main() => "foo";') |
| 215 ]), | 215 ]), |
| 216 dir('foo-dep', [ | 216 dir('foo-dep', [ |
| 217 file('foo-dep.dart', 'main() => "foo-dep";') | 217 file('foo-dep.dart', 'main() => "foo-dep";') |
| 218 ]) | 218 ]) |
| 219 ]).scheduleValidate(); | 219 ]).scheduleValidate(); |
| 220 | 220 |
| 221 git('foo.git', [ | 221 git('foo.git', [ |
| 222 libDir('foo', 'foo 2'), | 222 libDir('foo', 'foo 2'), |
| 223 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) | 223 libPubspec("foo", "1.0.0", [{"git": "../foo-dep.git"}]) |
| 224 ]).scheduleCreate(); | 224 ]).scheduleCreate(); |
| 225 | 225 |
| 226 git('foo-dep.git', [ | 226 git('foo-dep.git', [ |
| 227 libDir('foo-dep', 'foo-dep 2'), | 227 libDir('foo-dep', 'foo-dep 2'), |
| 228 libPubspec('foo-dep', '1.0.0') | 228 libPubspec('foo-dep', '1.0.0') |
| 229 ]).scheduleCommit(); | 229 ]).scheduleCommit(); |
| 230 | 230 |
| 231 schedulePub(args: ['update', 'foo'], | 231 schedulePub(args: ['update', 'foo'], |
| 232 output: const RegExp(@"Dependencies updated!$")); | 232 output: const RegExp(r"Dependencies updated!$")); |
| 233 | 233 |
| 234 dir(packagesPath, [ | 234 dir(packagesPath, [ |
| 235 dir('foo', [ | 235 dir('foo', [ |
| 236 file('foo.dart', 'main() => "foo 2";') | 236 file('foo.dart', 'main() => "foo 2";') |
| 237 ]), | 237 ]), |
| 238 dir('foo-dep', [ | 238 dir('foo-dep', [ |
| 239 file('foo-dep.dart', 'main() => "foo-dep";') | 239 file('foo-dep.dart', 'main() => "foo-dep";') |
| 240 ]), | 240 ]), |
| 241 ]).scheduleValidate(); | 241 ]).scheduleValidate(); |
| 242 | 242 |
| 243 run(); | 243 run(); |
| 244 }); | 244 }); |
| 245 }); | 245 }); |
| 246 } | 246 } |
| OLD | NEW |