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