File: symlink.t

package info (click to toggle)
libfuse-perl 0.16.1%2B20180422git6becd92d7fce3fc411d7c-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 612 kB
  • sloc: perl: 1,938; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
use test::helper qw($_point $_real);
use Test::More;
plan tests => 6;
chdir($_point);
ok(symlink("abc","def"),"symlink created");
ok(-l "def","symlink exists");
is(readlink("def"),"abc","it worked");
chdir($_real);
ok(-l "def","symlink really exists");
is(readlink("def"),"abc","really worked");
unlink("def");

# bug: doing a 'cp -a' on a directory which contains a symlink
# reports an error
mkdir("dira");
open($file, '>', 'dira/filea');
close($file);
symlink('filea', 'dira/fileb');
my $cp = 'cp -a';
if ($^O eq 'netbsd' || $^O eq 'openbsd') { $cp = 'cp -R'; }
is(system($cp . " dira dirb")>>8,0,$cp);
map { unlink($_) } ('dira/filea', 'dira/fileb', 'dirb/filea', 'dirb/fileb');
map { rmdir($_) } ('dira', 'dirb');