ACIL FM
Dark
Refresh
Current DIR:
/home/.cpan/build/Capture-Tiny-0.48-0/t
/
home
.cpan
build
Capture-Tiny-0.48-0
t
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
lib
-
chmod
Open
Rename
Delete
00-report-prereqs.dd
2.97 MB
chmod
View
DL
Edit
Rename
Delete
00-report-prereqs.t
5.77 MB
chmod
View
DL
Edit
Rename
Delete
01-Capture-Tiny.t
824 B
chmod
View
DL
Edit
Rename
Delete
02-capture.t
766 B
chmod
View
DL
Edit
Rename
Delete
03-tee.t
884 B
chmod
View
DL
Edit
Rename
Delete
06-stdout-closed.t
1 MB
chmod
View
DL
Edit
Rename
Delete
07-stderr-closed.t
1 MB
chmod
View
DL
Edit
Rename
Delete
08-stdin-closed.t
1.56 MB
chmod
View
DL
Edit
Rename
Delete
09-preserve-exit-code.t
737 B
chmod
View
DL
Edit
Rename
Delete
10-stdout-string.t
1.14 MB
chmod
View
DL
Edit
Rename
Delete
11-stderr-string.t
1.14 MB
chmod
View
DL
Edit
Rename
Delete
12-stdin-string.t
1.37 MB
chmod
View
DL
Edit
Rename
Delete
13-stdout-tied.t
1.25 MB
chmod
View
DL
Edit
Rename
Delete
14-stderr-tied.t
1.26 MB
chmod
View
DL
Edit
Rename
Delete
15-stdin-tied.t
1.27 MB
chmod
View
DL
Edit
Rename
Delete
16-catch-errors.t
1.18 MB
chmod
View
DL
Edit
Rename
Delete
17-pass-results.t
2.6 MB
chmod
View
DL
Edit
Rename
Delete
18-custom-capture.t
4.52 MB
chmod
View
DL
Edit
Rename
Delete
19-relayering.t
2.46 MB
chmod
View
DL
Edit
Rename
Delete
20-stdout-badtie.t
1.23 MB
chmod
View
DL
Edit
Rename
Delete
21-stderr-badtie.t
1.23 MB
chmod
View
DL
Edit
Rename
Delete
22-stdin-badtie.t
1.23 MB
chmod
View
DL
Edit
Rename
Delete
23-all-tied.t
1.57 MB
chmod
View
DL
Edit
Rename
Delete
24-all-badtied.t
1.5 MB
chmod
View
DL
Edit
Rename
Delete
25-cap-fork.t
1.24 MB
chmod
View
DL
Edit
Rename
Delete
Edit file: /home/.cpan/build/Capture-Tiny-0.48-0/t/18-custom-capture.t
# Copyright (c) 2009 by David Golden. All rights reserved. # Licensed under Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License was distributed with this file or you may obtain a # copy of the License from http://www.apache.org/licenses/LICENSE-2.0 use strict; use warnings; use Test::More; use lib 't/lib'; use IO::Handle; use IO::File; use File::Temp qw/tmpnam/; use Utils qw/next_fd sig_num/; use Capture::Tiny ':all'; use Config; plan tests => 19; local $ENV{PERL_CAPTURE_TINY_TIMEOUT} = 0; # no timeouts my $builder = Test::More->builder; binmode($builder->failure_output, ':utf8') if $] >= 5.008; my $fd = next_fd; my ($out, $err, $res, @res); #--------------------------------------------------------------------------# # capture to custom IO::File #--------------------------------------------------------------------------# my $temp_out = tmpnam(); my $temp_err = tmpnam(); ok( !-e $temp_out, "Temp out '$temp_out' doesn't exist" ); ok( !-e $temp_err, "Temp out '$temp_err' doesn't exist" ); my $out_fh = IO::File->new($temp_out, "w+"); my $err_fh = IO::File->new($temp_err, "w+"); capture { print STDOUT "foo\n"; print STDERR "bar\n"; } stdout => $out_fh, stderr => $err_fh; $out_fh->close; $err_fh->close; is( scalar do {local (@ARGV,$/) = $temp_out; <>} , "foo\n", "captured STDOUT to custom handle (IO::File)" ); is( scalar do {local (@ARGV,$/) = $temp_err; <>} , "bar\n", "captured STDERR to custom handle (IO::File)" ); unlink $_ for $temp_out, $temp_err; #--------------------------------------------------------------------------# # capture to GLOB handle #--------------------------------------------------------------------------# $temp_out = tmpnam(); $temp_err = tmpnam(); ok( !-e $temp_out, "Temp out '$temp_out' doesn't exist" ); ok( !-e $temp_err, "Temp out '$temp_err' doesn't exist" ); open $out_fh, "+>", $temp_out; open $err_fh, "+>", $temp_err; capture { print STDOUT "foo\n"; print STDERR "bar\n"; } stdout => $out_fh, stderr => $err_fh; $out_fh->close; $err_fh->close; is( scalar do {local (@ARGV,$/) = $temp_out; <>} , "foo\n", "captured STDOUT to custom handle (GLOB)" ); is( scalar do {local (@ARGV,$/) = $temp_err; <>} , "bar\n", "captured STDERR to custom handle (GLOB)" ); unlink $_ for $temp_out, $temp_err; #--------------------------------------------------------------------------# # append to custom IO::File #--------------------------------------------------------------------------# $temp_out = tmpnam(); $temp_err = tmpnam(); ok( !-e $temp_out, "Temp out '$temp_out' doesn't exist" ); ok( !-e $temp_err, "Temp out '$temp_err' doesn't exist" ); $out_fh = IO::File->new($temp_out, "w+"); $err_fh = IO::File->new($temp_err, "w+"); $out_fh->autoflush(1); $err_fh->autoflush(1); print $out_fh "Shouldn't see this in capture\n"; print $err_fh "Shouldn't see this in capture\n"; my ($got_out, $got_err) = capture { print STDOUT "foo\n"; print STDERR "bar\n"; } stdout => $out_fh, stderr => $err_fh; $out_fh->close; $err_fh->close; is( $got_out, "foo\n", "captured appended STDOUT to custom handle" ); is( $got_err, "bar\n", "captured appended STDERR to custom handle" ); unlink $_ for $temp_out, $temp_err; #--------------------------------------------------------------------------# # repeated append to custom IO::File with no output #--------------------------------------------------------------------------# $temp_out = tmpnam(); $temp_err = tmpnam(); ok( !-e $temp_out, "Temp out '$temp_out' doesn't exist" ); ok( !-e $temp_err, "Temp out '$temp_err' doesn't exist" ); $out_fh = IO::File->new($temp_out, "a+"); $err_fh = IO::File->new($temp_err, "a+"); ($got_out, $got_err) = capture { my $i = 0; $i++ for 1 .. 10; # no output, just busywork } stdout => $out_fh, stderr => $err_fh; is( $got_out, "", "Try 1: captured empty appended STDOUT to custom handle" ); is( $got_err, "", "Try 1: captured empty appended STDERR to custom handle" ); ($got_out, $got_err) = capture { my $i = 0; $i++ for 1 .. 10; # no output, just busywork } stdout => $out_fh, stderr => $err_fh; is( $got_out, "", "Try 2: captured empty appended STDOUT to custom handle" ); is( $got_err, "", "Try 2: captured empty appended STDERR to custom handle" ); unlink $_ for $temp_out, $temp_err; #--------------------------------------------------------------------------# # finish #--------------------------------------------------------------------------# close ARGV; # opened by reading from <> is( next_fd, $fd, "no file descriptors leaked" ); exit 0;
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply