Module::Starter 的 manifest.t 中的预期开发过程是什么?

发布于 2024-11-08 02:54:41 字数 794 浏览 0 评论 0原文

Module::Starter 初始化项目时,它会创建一个名为 manifest 的测试.t

#!perl -T

use strict;
use warnings;
use Test::More;

unless ( $ENV{RELEASE_TESTING} ) {
    plan( skip_all => "Author tests not required for installation" );
}

eval "use Test::CheckManifest 0.9";
plan skip_all => "Test::CheckManifest 0.9 required" if $@;
ok_manifest();

当您使用 Build test 运行测试时,这是输出的一部分:

t\00-load.t ....... ok
t\boilerplate.t ... ok
t\manifest.t ...... skipped: Author tests not required for installation

我从狭义上理解结果(未设置 $ENV{RELEASE_TESTING} ,因此测试是跳过),但我没有完全掌握大局。预期的开发流程是什么?我认为运行测试来确认我的模块的清单是准确的是个好主意。我应该设置该环境变量吗?如果是,那么在开发过程的哪个阶段?

When Module::Starter initializes a project, it creates a test called manifest.t.

#!perl -T

use strict;
use warnings;
use Test::More;

unless ( $ENV{RELEASE_TESTING} ) {
    plan( skip_all => "Author tests not required for installation" );
}

eval "use Test::CheckManifest 0.9";
plan skip_all => "Test::CheckManifest 0.9 required" if $@;
ok_manifest();

When you run tests with Build test, here's part of the output:

t\00-load.t ....... ok
t\boilerplate.t ... ok
t\manifest.t ...... skipped: Author tests not required for installation

I understand the outcome in a narrow sense ($ENV{RELEASE_TESTING} is not set, so the tests are skipped), but I don't fully grasp the big picture. What's the intended development process? I assume it's a good idea to run tests to confirm that my module's manifest is accurate. Should I be setting that environment variable? If so, at what point during the development process?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜灵血窟げ 2024-11-15 02:54:41

许多模块发行版都有测试,这些测试不是检查代码是否有效,而是检查发行版是否处于适合发布的状态。例如 MANIFEST 是否是最新的、所有函数是否已记录在 POD 中等。

为了节省时间,这些测试可能会被编写为跳过它们自己,除非设置了 RELEASE_TESTING 环境变量。这是一个非正式的标准。这样,当人们安装模块时,这些测试就不会运行,当作者只是检查代码更改是否破坏任何内容时,它们也不会运行。

在发布您的 dist 之前,您应该运行 RELEASE_TESTING=1 make test (或等效的 Build)。如果您使用 Dist::Zilla (我强烈推荐),您可以运行使用 dzil test --release 发布测试。该标志也由 TestRelease 插件,如果你使用 dzil,你一定要使用它。

通常用于控制测试的其他环境变量是 AUTOMATED_TESTING 和 AUTHOR_TESTING。 AUTOMATED_TESTING 由运行自动冒烟测试的CPAN 测试人员设置。

Many module distributions have tests that check not whether the code works, but whether the distribution is in a suitable state for releasing. Things like the MANIFEST being up to date, whether all functions have been documented in POD, etc.

In order to save time, these tests may be written to skip themselves unless the RELEASE_TESTING environment variable is set. This is an informal standard. That way, these tests don't get run when people install the module, nor do they run when the author is just checking to see if a code change broke anything.

You should run RELEASE_TESTING=1 make test (or the Build equivalent) before releasing your dist. If you use Dist::Zilla (which I highly recommend), you can run release tests with dzil test --release. That flag is also set automatically by the TestRelease plugin, which you should definitely use if you use dzil.

Other environment variables commonly used to control testing are AUTOMATED_TESTING and AUTHOR_TESTING. AUTOMATED_TESTING is set by CPAN testers running automated smoke tests.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文