@@ -8,32 +8,36 @@ import 'package:path/path.dart' as p;
88import 'package:tar/tar.dart' ;
99import 'package:test/test.dart' ;
1010
11- import '../descriptor.dart' ;
11+ import '../descriptor.dart' as d;
12+ import '../link_descriptor.dart' ;
1213import '../test_pub.dart' ;
1314
1415Future <void > main () async {
1516 test ('symlink directories are replaced by their targets' , () async {
16- await validPackage ().create ();
17- await dir ('a' , [file ('aa' , 'aaa' )]).create ();
18- await file ('t' , 'ttt' ).create ();
17+ await d. validPackage ().create ();
18+ await d. dir ('a' , [d. file ('aa' , 'aaa' )]).create ();
19+ await d. file ('t' , 'ttt' ).create ();
1920
20- await dir (appPath, [
21- dir ('b' , [file ('bb' , 'bbb' )]),
21+ await d.dir (appPath, [
22+ d.dir ('b' , [d.file ('bb' , 'bbb' ), link ('l' , p.join (d.sandbox, 't' ))]),
23+ link (
24+ 'symlink_to_dir_outside_package' ,
25+ p.join (d.sandbox, 'a' ),
26+ forceDirectory: true ,
27+ ),
28+ link (
29+ 'symlink_to_dir_outside_package_relative' ,
30+ p.join ('..' , 'a' ),
31+ forceDirectory: true ,
32+ ),
33+ link ('symlink_to_dir_inside_package' , p.join (d.sandbox, appPath, 'b' )),
34+ link ('symlink_to_dir_inside_package_relative' , 'b' , forceDirectory: true ),
2235 ]).create ();
23- Link (p.join (sandbox, appPath, 'symlink_to_dir_outside_package' ))
24- .createSync (p.join (sandbox, 'a' ));
25- Link (p.join (sandbox, appPath, 'symlink_to_dir_outside_package_relative' ))
26- .createSync (p.join ('..' , 'a' ));
27- Link (p.join (sandbox, appPath, 'symlink_to_dir_inside_package' ))
28- .createSync (p.join (sandbox, appPath, 'b' ));
29- Link (p.join (sandbox, appPath, 'symlink_to_dir_inside_package_relative' ))
30- .createSync ('b' );
31- Link (p.join (sandbox, appPath, 'b' , 'l' )).createSync (p.join (sandbox, 't' ));
3236
3337 await runPub (args: ['publish' , '--to-archive=archive.tar.gz' ]);
3438
3539 final reader = TarReader (
36- File (p.join (sandbox, appPath, 'archive.tar.gz' ))
40+ File (p.join (d. sandbox, appPath, 'archive.tar.gz' ))
3741 .openRead ()
3842 .transform (GZipCodec ().decoder),
3943 );
@@ -45,25 +49,25 @@ Future<void> main() async {
4549
4650 await runPub (args: ['cache' , 'preload' , 'archive.tar.gz' ]);
4751
48- await dir ('test_pkg-1.0.0' , [
49- ...validPackage ().contents,
50- dir ('symlink_to_dir_outside_package' , [
51- file ('aa' , 'aaa' ),
52+ await d. dir ('test_pkg-1.0.0' , [
53+ ...d. validPackage ().contents,
54+ d. dir ('symlink_to_dir_outside_package' , [
55+ d. file ('aa' , 'aaa' ),
5256 ]),
53- dir ('symlink_to_dir_outside_package_relative' , [
54- file ('aa' , 'aaa' ),
57+ d. dir ('symlink_to_dir_outside_package_relative' , [
58+ d. file ('aa' , 'aaa' ),
5559 ]),
56- dir ('b' , [file ('bb' , 'bbb' )]),
57- dir ('symlink_to_dir_inside_package' , [
58- file ('bb' , 'bbb' ),
59- file ('l' , 'ttt' ),
60+ d. dir ('b' , [d. file ('bb' , 'bbb' )]),
61+ d. dir ('symlink_to_dir_inside_package' , [
62+ d. file ('bb' , 'bbb' ),
63+ d. file ('l' , 'ttt' ),
6064 ]),
61- dir ('symlink_to_dir_inside_package_relative' , [
62- file ('bb' , 'bbb' ),
63- file ('l' , 'ttt' ),
65+ d. dir ('symlink_to_dir_inside_package_relative' , [
66+ d. file ('bb' , 'bbb' ),
67+ d. file ('l' , 'ttt' ),
6468 ]),
6569 ]).validate (
66- p.join (sandbox, cachePath, 'hosted' , 'pub.dev' ),
70+ p.join (d. sandbox, cachePath, 'hosted' , 'pub.dev' ),
6771 );
6872 });
6973}
0 commit comments