⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 01_history.t

📁 source of perl for linux application,
💻 T
字号:
use Test::More 'no_plan';use strict;BEGIN {     chdir 't' if -d 't';    use File::Spec;    use lib File::Spec->catdir( qw[.. lib] );}my $Class   = 'Term::UI::History';my $Func    = 'history';my $Verbose = 0;            # print to STDOUT?### test load & exports{   use_ok( $Class );    for my $pkg ( $Class, __PACKAGE__ ) {        can_ok( $pkg, $Func );    }    }### test string recording{   history( $$, $Verbose );       my $str = $Class->history_as_string;    ok( $str,                   "Message recorded" );    is( $str, $$,               "   With appropriate content" );        $Class->flush;    ok( !$Class->history_as_string,                                "   Stack flushed" );}### test filehandle printing SKIP: {       my $file = "$$.tmp";        {   open my $fh, ">$file" or skip "Could not open $file: $!", 6;            ### declare twice for 'used only once' warning        local $Term::UI::History::HISTORY_FH = $fh;        local $Term::UI::History::HISTORY_FH = $fh;                    history( $$ );        close $fh;    }        my $str = $Class->history_as_string;    ok( $str,                   "Message recorded" );    is( $str, $$,               "   With appropriate content" );        ### check file contents    {   ok( -e $file,           "File $file exists" );        ok( -s $file,           "   File has size" );            open my $fh, $file or skip "Could not open $file: $!", 2;        my $cont = do { local $/; <$fh> };        chomp $cont;                is( $cont, $str,        "   File has same content" );    }            $Class->flush;        ### for VMS etc    1 while unlink $file;        ok( ! -e $file,             "   File $file removed" );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -