Test2::Tools::Tiny - 无法使用 Test2::Suite 的不幸灵魂的微型工具集。
您应该真正看看 Test2::Suite。此包是一些使用 Test2 实现的非常基本的必要工具。它只存在是为了测试 Test2 和 Test2::Suite 所需的其他工具。这是 Test2 用于测试自身的包。
#请改用 Test2::Suite
如果可能,请使用 Test2::Suite。
- #ok($bool, $name)
-
- #ok($bool, $name, @diag)
-
运行简单的断言。
- #is($got, $want, $name)
-
- #is($got, $want, $name, @diag)
-
断言两个字符串相同。
- #isnt($got, $do_not_want, $name)
-
- #isnt($got, $do_not_want, $name, @diag)
-
断言两个字符串不相同。
- #like($got, $regex, $name)
-
- #like($got, $regex, $name, @diag)
-
检查输入字符串是否匹配正则表达式。
- #unlike($got, $regex, $name)
-
- #unlike($got, $regex, $name, @diag)
-
检查输入字符串是否不匹配正则表达式。
- #is_deeply($got, $want, $name)
-
- #is_deeply($got, $want, $name, @diag)
-
检查两个数据结构。请注意,这是一个DUMB实现,它将Data::Dumper的输出与两个结构进行比较。
- #diag($msg)
-
向 STDERR 发出诊断消息。
- #note($msg)
-
向 STDOUT 发出诊断消息。
- #skip_all($reason)
-
跳过所有测试。
- #todo $reason => sub { ... }
-
在 TODO 模式下运行代码块。
- #plan($count)
-
设置计划。
- #done_testing()
-
将计划设置为当前测试计数。
- #$warnings = warnings { ... }
-
从代码块中捕获一个警告数组引用。
- #$exception = exception { ... }
-
捕获异常。
- #tests $name => sub { ... }
-
运行子测试。
- #$output = capture { ... }
-
捕获 STDOUT 和 STDERR 输出。
结果如下所示
{
STDOUT => "...",
STDERR => "...",
}
#SOURCE
Test2 的源代码仓库可以在 http://github.com/Test-More/test-more/ 找到。
#MAINTAINERS
- #Chad Granum <exodist@cpan.org>
-
#AUTHORS
- #Chad Granum <exodist@cpan.org>
-
#COPYRIGHT
Copyright 2020 Chad Granum <exodist@cpan.org>.
本程序是自由软件;您可以根据 Perl 本身的条款重新发布和/或修改它。
参见 https://dev.perl.net.cn/licenses/