File: dm_skeleton.t

package info (click to toggle)
libtest-file-perl 1.29-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 180 kB
  • ctags: 40
  • sloc: perl: 771; makefile: 2
file content (81 lines) | stat: -rw-r--r-- 2,224 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
use strict;

use Test::Builder::Tester;
use Test::More tests => 19; # includes those in t/setup_common
use Test::File;

my $test_directory = 'test_files';
SKIP: {
    skip "setup already done", 5 if -d $test_directory;
    require "t/setup_common";
};

chdir $test_directory or print "bail out! Could not change directories: $!";

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# Subroutines are defined
ok( defined &Test::File::_dm_skeleton, "_dm_skeleton is defined" );

my $readable  = 'readable';
my $not_there = 'not_there';
my $test_name = 'This is my test name';

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# Fake a non-multi-user OS
{
local $^O = 'dos';
ok( Test::File::_obviously_non_multi_user(), "Is not multi user" );

is( Test::File::_dm_skeleton(),           'skip', "Skip on single user systems" );
is( Test::File::_dm_skeleton($readable),  'skip', "Skip on single user systems" );
is( Test::File::_dm_skeleton($not_there), 'skip', "Skip on single user systems" );
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# Fake a multi-user OS with existing file
{
local $^O = 'darwin';
ok( ! Test::File::_obviously_non_multi_user(), "Is multi user" );



}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# Fake a multi-user OS with non-existing file
{
local $^O = 'darwin';
ok( ! Test::File::_obviously_non_multi_user(), "Is multi user" );

test_out( "not ok 1" );
test_diag( 
	"File [$not_there] does not exist!\n" .
	"#   Failed test at $0 line " . line_num(+4) . "."
	);
Test::File::_dm_skeleton( $not_there );
test_test();
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# Fake a multi-user OS with no argument
{
local $^O = 'darwin';
ok( ! Test::File::_obviously_non_multi_user(), "Is multi user" );

test_out( "not ok 1" );
test_diag( 
	"File name not specified!\n" .
	"#   Failed test at $0 line " . line_num(+4) . "."
	);
Test::File::_dm_skeleton();
test_test();
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

chdir '..' or print "bail out! Could not change directories: $!";

END {
unlink glob( "test_files/*" );
rmdir "test_files";
}