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

Side by Side Diff: utils/tests/pub/pub_test.dart

Issue 10854152: Allow `pub install` and `pub update` to update dependers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor changes Created 8 years, 4 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
« utils/pub/version_solver.dart ('K') | « utils/pub/version_solver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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('../../../lib/unittest/unittest.dart'); 10 #import('../../../lib/unittest/unittest.dart');
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 output: const RegExp(@"Dependencies installed!$")); 861 output: const RegExp(@"Dependencies installed!$"));
862 862
863 dir(packagesPath, [ 863 dir(packagesPath, [
864 dir('foo', [ 864 dir('foo', [
865 file('foo.dart', 'main() => print("foo 1.0.0");') 865 file('foo.dart', 'main() => print("foo 1.0.0");')
866 ]) 866 ])
867 ]).scheduleValidate(); 867 ]).scheduleValidate();
868 868
869 run(); 869 run();
870 }); 870 });
871
872 test("unlocks dependencies if necessary to ensure that a new dependency "
873 "is satisfied", () {
Bob Nystrom 2012/08/15 17:48:16 I'd like to also have a test to ensure that depend
nweiz 2012/08/15 21:25:42 Done.
874 servePackages("localhost", 3123, [
875 '''
876 name: foo
877 version: 1.0.0
878 dependencies:
879 bar:
880 version: "<2.0.0"
881 repo: {name: bar, url: http://localhost:3123}
882 ''',
883 '''
884 name: bar
885 version: 1.0.0
886 dependencies:
887 baz:
888 version: "<2.0.0"
889 repo: {name: baz, url: http://localhost:3123}
890 ''',
891 '''
892 name: baz
893 version: 1.0.0
894 ''']);
895
896 dir(appPath, [
897 file('pubspec.yaml', '''
898 dependencies:
899 foo:
900 repo: {name: foo, url: http://localhost:3123}
901 ''')
902 ]).scheduleCreate();
903
904 schedulePub(args: ['install'],
905 output: const RegExp(@"Dependencies installed!$"));
906
907 dir(packagesPath, [
908 dir('foo', [
909 file('foo.dart', 'main() => print("foo 1.0.0");')
910 ]),
911 dir('bar', [
912 file('bar.dart', 'main() => print("bar 1.0.0");')
913 ]),
914 dir('baz', [
915 file('baz.dart', 'main() => print("baz 1.0.0");')
916 ])
917 ]).scheduleValidate();
918
919 servePackages("localhost", 3123, [
920 '''
921 name: foo
922 version: 1.0.0
923 dependencies:
924 bar:
925 version: "<2.0.0"
926 repo: {name: bar, url: http://localhost:3123}
927 ''',
928 '''
929 name: foo
930 version: 2.0.0
931 dependencies:
932 bar:
933 version: "<3.0.0"
934 repo: {name: bar, url: http://localhost:3123}
935 ''',
936 '''
937 name: bar
938 version: 1.0.0
939 dependencies:
940 baz:
941 version: "<2.0.0"
942 repo: {name: baz, url: http://localhost:3123}
943 ''',
944 '''
945 name: bar
946 version: 2.0.0
947 dependencies:
948 baz:
949 version: "<3.0.0"
950 repo: {name: baz, url: http://localhost:3123}
951 ''',
952 '''
953 name: baz
954 version: 1.0.0
955 ''',
956 '''
957 name: baz
958 version: 2.0.0
959 ''',
960 '''
961 name: newdep
962 version: 2.0.0
963 dependencies:
964 baz:
965 version: ">=1.5.0"
966 repo: {name: baz, url: http://localhost:3123}
967 ''']);
968
969 dir(appPath, [
970 file('pubspec.yaml', '''
971 dependencies:
972 foo:
973 repo: {name: foo, url: http://localhost:3123}
974 newdep:
975 repo: {name: newdep, url: http://localhost:3123}
976 ''')
977 ]).scheduleCreate();
978
979 schedulePub(args: ['install'],
980 output: const RegExp(@"Dependencies installed!$"));
981
982 dir(packagesPath, [
983 dir('foo', [
984 file('foo.dart', 'main() => print("foo 2.0.0");')
Bob Nystrom 2012/08/15 17:48:16 Since servePackages() automatically generates thes
nweiz 2012/08/15 21:25:42 I agree. I'm vaguely planning on doing a test clea
985 ]),
986 dir('bar', [
987 file('bar.dart', 'main() => print("bar 2.0.0");')
988 ]),
989 dir('baz', [
990 file('baz.dart', 'main() => print("baz 2.0.0");')
991 ]),
992 dir('newdep', [
993 file('newdep.dart', 'main() => print("newdep 2.0.0");')
994 ])
995 ]).scheduleValidate();
996
997 run();
998 });
871 } 999 }
872 1000
873 updateCommand() { 1001 updateCommand() {
874 test("updates locked Git packages", () { 1002 test("updates locked Git packages", () {
875 ensureGit(); 1003 ensureGit();
876 1004
877 git('foo.git', [ 1005 git('foo.git', [
878 file('foo.dart', 'main() => "foo";') 1006 file('foo.dart', 'main() => "foo";')
879 ]).scheduleCreate(); 1007 ]).scheduleCreate();
880 1008
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 version: ">1.0.0" 1260 version: ">1.0.0"
1133 ''') 1261 ''')
1134 ]), 1262 ]),
1135 dir('foo-dep', [ 1263 dir('foo-dep', [
1136 file('foo-dep.dart', 'main() => print("foo-dep 2.0.0");') 1264 file('foo-dep.dart', 'main() => print("foo-dep 2.0.0");')
1137 ]) 1265 ])
1138 ]).scheduleValidate(); 1266 ]).scheduleValidate();
1139 1267
1140 run(); 1268 run();
1141 }); 1269 });
1270
1271 test("updates a locked package's dependers in order to get it to max "
1272 "version", () {
1273 servePackages("localhost", 3123, [
1274 '''
1275 name: foo
1276 version: 1.0.0
1277 dependencies:
1278 bar:
1279 version: "<2.0.0"
1280 repo: {name: bar, url: http://localhost:3123}
1281 ''',
1282 '{name: bar, version: 1.0.0}'
1283 ]);
1284
1285 dir(appPath, [
1286 file('pubspec.yaml', '''
1287 dependencies:
1288 foo:
1289 repo: {name: foo, url: http://localhost:3123}
1290 bar:
1291 repo: {name: bar, url: http://localhost:3123}
1292 ''')
1293 ]).scheduleCreate();
1294
1295 schedulePub(args: ['install'],
1296 output: const RegExp(@"Dependencies installed!$"));
1297
1298 dir(packagesPath, [
1299 dir('foo', [
1300 file('foo.dart', 'main() => print("foo 1.0.0");'),
1301 ]),
1302 dir('bar', [
1303 file('bar.dart', 'main() => print("bar 1.0.0");')
1304 ])
1305 ]).scheduleValidate();
1306
1307 servePackages("localhost", 3123, [
1308 '''
1309 name: foo
1310 version: 1.0.0
1311 dependencies:
1312 bar:
1313 version: "<2.0.0"
1314 repo: {name: bar, url: http://localhost:3123}
1315 ''',
1316 '''
1317 name: foo
1318 version: 2.0.0
1319 dependencies:
1320 bar:
1321 version: "<3.0.0"
1322 repo: {name: bar, url: http://localhost:3123}
1323 ''',
1324 '{name: bar, version: 1.0.0}',
1325 '{name: bar, version: 2.0.0}'
1326 ]);
1327
1328 schedulePub(args: ['update', 'bar'],
1329 output: const RegExp(@"Dependencies updated!$"));
1330
1331 dir(packagesPath, [
1332 dir('foo', [
1333 file('foo.dart', 'main() => print("foo 2.0.0");'),
1334 ]),
1335 dir('bar', [
1336 file('bar.dart', 'main() => print("bar 2.0.0");')
1337 ])
1338 ]).scheduleValidate();
1339
1340 run();
1341 });
1142 }); 1342 });
1143 } 1343 }
1144 1344
1145 versionCommand() { 1345 versionCommand() {
1146 test('displays the current version', () => 1346 test('displays the current version', () =>
1147 runPub(args: ['version'], output: VERSION_STRING)); 1347 runPub(args: ['version'], output: VERSION_STRING));
1148 } 1348 }
OLDNEW
« utils/pub/version_solver.dart ('K') | « utils/pub/version_solver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698