File: 07-delete.t

package info (click to toggle)
libdirectory-scratch-perl 0.18-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 404 kB
  • ctags: 25
  • sloc: perl: 1,173; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 765 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl
# 07-delete.t 
# Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
use Directory::Scratch;
use Test::More tests=>15;
use strict;
use warnings;

my $t = Directory::Scratch->new;

eval {
    $t->delete('fake');
};
ok($@, "can't delete things that don't exist");

ok($t->mkdir('foo'));
ok($t->touch('foo/bar'));

eval {
    $t->delete('foo');
};
ok($@, "can't delete non-empty directories");

ok($t->exists('foo'));
ok($t->exists('foo/bar'));
ok($t->delete('foo/bar'));
ok($t->delete('foo'));
ok(!$t->exists('foo'));
ok(!$t->exists('foo/bar'));

ok($t->touch('foo'));

SKIP: {
    skip 'no links on win32', 4 if $^O eq 'MSWin32';
    ok($t->link('foo', 'bar'));
    ok($t->exists('bar'));
    ok($t->delete('bar'));
    ok(!$t->exists('bar'));
}