title: "Then /^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/" post_status: publish comment_status: open taxonomy: category: - wp-cli-handbook post_tag: - Behat Steps - References - Repos


Then /^(STDOUT|STDERR) should( not)? match (((\/.+\/)|(#.+#))([a-z]+)?)$/

将 STDOUT 或 STDERR 与正则表达式进行匹配。


用法

Scenario: 我的示例场景
  When I run `wp dist-archive wp-content/plugins/hello-world`
  Then STDOUT should match /^Success: Created hello-world.0.1.0.zip \(Size: \d+(?:\.\d*)? [a-zA-Z]{1,3}\)$/

Behat 步骤文档在每次发布时从 WP-CLI 代码库生成。如需改进,请提交拉取请求。


相关