gpt4 book ai didi

rspec - RSpec 中文件路径后方括号中的信息是什么意思?

转载 作者:行者123 更新时间:2023-12-01 12:24:54 29 4
gpt4 key购买 nike

RSpec 的文档提到了 --bisect option ,当运行时提供最小的复制,例如

rspec ./spec/calculator_10_spec.rb[1:1] ./spec/calculator_1_spec.rb[1:1] --seed 1234
[1:1] 有什么用有点意思?

最佳答案

来自 rspec --help :

**** Filtering/tags ****

In addition to the following options for selecting specific files, groups, or examples, you can select individual examples by appending the line number(s) to the filename:

rspec path/to/a_spec.rb:37:87

You can also pass example ids enclosed in square brackets:

rspec path/to/a_spec.rb[1:5,1:6]
# run the 5th and 6th examples/groups defined in the 1st group


RSpec 3.3 的发行说明中提到了它:

RSpec 3.3 introduces a new way to identify examples and example groups: unique IDs. The IDs are scoped to a particular file and are based on the index of the example or group. For example, this command:

$ rspec spec/unit/baseball_spec.rb[1:2,1:4]

…would run the 2nd and 4th example or group defined under the 1st top-level group defined in spec/unit/baseball_spec.rb.

关于rspec - RSpec 中文件路径后方括号中的信息是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40878681/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com