… | |
… | |
3 | $| = 1; |
3 | $| = 1; |
4 | |
4 | |
5 | # not tested: symlink, readlink, link, utime, chown, chmod |
5 | # not tested: symlink, readlink, link, utime, chown, chmod |
6 | |
6 | |
7 | BEGIN { |
7 | BEGIN { |
8 | print "1..38\n"; |
8 | print "1..37\n"; |
9 | print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; |
9 | print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; |
10 | } |
10 | } |
11 | use AnyEvent; |
11 | use AnyEvent; |
12 | use AnyEvent::IO qw(:DEFAULT :flags); |
12 | use AnyEvent::IO qw(:DEFAULT :flags); |
13 | BEGIN { |
13 | BEGIN { |
… | |
… | |
25 | print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; |
25 | print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; |
26 | |
26 | |
27 | wantarray ? @res : $res[0] |
27 | wantarray ? @res : $res[0] |
28 | } |
28 | } |
29 | |
29 | |
30 | our $TMP = "/tmp"; |
30 | use File::Spec; |
|
|
31 | |
|
|
32 | our $TMP = File::Spec->tmpdir; |
31 | our $DIR = "$TMP/ae_io_testdir_$$~"; |
33 | our $DIR = "$TMP/ae_io_testdir_$$~"; |
32 | |
34 | |
33 | t 1, mkdir => $DIR, 0777 |
35 | t 1, mkdir => $DIR, 0777 |
34 | or do { print "Bail out! Cannot mkdir $DIR, skipping test.\n"; exit 0 }; |
36 | or do { print "Bail out! Cannot mkdir $DIR, skipping test.\n"; exit 0 }; |
35 | t 0, mkdir => $DIR, 0777; |
37 | t 0, mkdir => $DIR, 0777; |
… | |
… | |
41 | t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; |
43 | t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; |
42 | |
44 | |
43 | t 0, rmdir => $DIR; |
45 | t 0, rmdir => $DIR; |
44 | |
46 | |
45 | t 1, write => $fh, "tes--"; |
47 | t 1, write => $fh, "tes--"; |
46 | t 1, write => $fh, "test2truncate"; |
48 | t 1, write => $fh, "test2"; |
47 | t 1, write => $fh, ""; |
49 | t 1, write => $fh, ""; |
48 | |
50 | |
49 | t 1, seek => $fh, 3, 0; |
51 | t 1, seek => $fh, 3, 0; |
50 | t 1, write => $fh, "t1"; |
52 | t 1, write => $fh, "t1"; |
51 | |
53 | |
52 | t 1, truncate => $fh, 5+5; |
54 | #t 1, truncate => $fh, 5+5; # not available on windows |
53 | |
55 | |
54 | t 1, stat => $fh; |
56 | t 1, stat => $fh; |
55 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; |
57 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; |
56 | |
58 | |
57 | t 1, close => $fh; |
59 | t 1, close => $fh; |
58 | |
60 | |
59 | t 1, stat => "$DIR/test"; |
61 | t 1, stat => "$DIR/test"; |
60 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; |
62 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size (", -s _,")\n"; |
61 | |
63 | |
62 | t 1, lstat => "$DIR/test"; |
64 | t 1, lstat => "$DIR/test"; |
63 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n"; |
65 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n"; |
64 | |
66 | |
65 | t 1, rename => "$DIR/test", "$DIR/test2"; |
67 | t 1, rename => "$DIR/test", "$DIR/test2"; |