Sha256: 0fb91709fb30895d05c3f230ae2ab92fb3247d673bcc89dd5794434c62686885
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require "crude-mutant" require "optparse" test_command = ARGV[0] file_to_mutate = ARGV[1] Options = Struct.new(:use_json_printer) args = Options.new(false) OptionParser.new do |opts| opts.banner = "Usage: crude-mutant [options] [test command] [file to mutate]" opts.on("-j", "--json", "Print JSON out to STDOUT") do |v| args.use_json_printer = v end end.parse! if !file_to_mutate || !test_command puts "Usage: crude-mutant [test command] [file to mutate]" puts "" puts "Example:" puts " crude-mutant \"bundle exec rspec\" app/models/post.rb" exit(1) end printer = args.use_json_printer ? :json : :standard CrudeMutant.start(file_to_mutate, test_command, result_printer: printer) do |progress| clear_string = ' ' * CrudeMutant::TerminalCalculator.new.calculate_length $stdout.print clear_string $stdout.print "\r" completed = "Completed #{progress.run_results.size}/#{progress.total_runs_to_perform}" average = "Average time per run: #{progress.avg_time.round(2)} second(s)" eta_time = (progress.total_runs_to_perform - progress.run_results.size) * progress.avg_time eta = "Estimated time of completion: #{eta_time.round(2)} seconds" $stdout.print "#{completed} #{average} #{eta}\r" $stdout.flush end
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
crude-mutant-0.3.0 | exe/cm |
crude-mutant-0.3.0 | exe/crude-mutant |