📄 testutil.pl
字号:
{ my $__ntest; my $__total; sub plan { @_ == 2 or die "usage: plan(tests => count)"; my $what = shift; $what eq 'tests' or die "cannot plan anything but tests"; $__total = shift; defined $__total && $__total > 0 or die "need a positive number of tests"; print "1..$__total\n"; } sub skip { my $reason = shift; ++$__ntest; print "ok $__ntest # skip: $reason\n" } sub ok ($;$$) { local($\,$,); my $ok = 0; my $result = shift; if (@_ == 0) { $ok = $result; } else { $expected = shift; if (!defined $expected) { $ok = !defined $result; } elsif (!defined $result) { $ok = 0; } elsif (ref($expected) eq 'Regexp') { die "using regular expression objects is not backwards compatible"; } else { $ok = $result eq $expected; } } ++$__ntest; if ($ok) { print "ok $__ntest\n" } else { print "not ok $__ntest\n" } }}1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -