mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
don't ignore --seed
option
`--seed N` option is just ignored so respect this option. [Feature #16655] Also making "Run options" display pretty.
This commit is contained in:
parent
83705c42ce
commit
116c632095
1 changed files with 13 additions and 2 deletions
|
@ -64,7 +64,18 @@ module Test
|
|||
args = @init_hook.call(args, options) if @init_hook
|
||||
non_options(args, options)
|
||||
@run_options = orig_args
|
||||
@help = orig_args.map { |s| s =~ /[\s|&<>$()]/ ? s.inspect : s }.join " "
|
||||
|
||||
if seed = options[:seed]
|
||||
srand(seed)
|
||||
else
|
||||
seed = options[:seed] = srand % 100_000
|
||||
srand(seed)
|
||||
orig_args << "--seed=#{seed}"
|
||||
end
|
||||
|
||||
@help = "\n" + orig_args.map { |s|
|
||||
" " + (s =~ /[\s|&<>$()]/ ? s.inspect : s)
|
||||
}.join("\n")
|
||||
@options = options
|
||||
end
|
||||
|
||||
|
@ -79,7 +90,7 @@ module Test
|
|||
end
|
||||
|
||||
opts.on '-s', '--seed SEED', Integer, "Sets random seed" do |m|
|
||||
options[:seed] = m
|
||||
options[:seed] = m.to_i
|
||||
end
|
||||
|
||||
opts.on '-v', '--verbose', "Verbose. Show progress processing files." do
|
||||
|
|
Loading…
Reference in a new issue