зеркало из https://github.com/github/ruby.git
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:
Родитель
83705c42ce
Коммит
116c632095
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче