Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions scripts/create_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,26 @@
if $0 == __FILE__

# make sure there is at least one parameter left (the input file)
if ARGV.length < 2
puts ["\nusage: ruby #{__FILE__} input_test_file (output)",
if ARGV.empty?
puts ["\nusage: ruby #{__FILE__} input_test_file [output_runner] [config.yml]",
'',
' input_test_file - this is the C file you want to create a runner for',
' output - this is the name of the runner file to generate',
' defaults to (input_test_file)_Runner'].join("\n")
' output_runner - (optional) the name of the runner file to generate',
' defaults to (input_test_file)_Runner.c',
' config.yml - (optional) a yaml file with configuration.'].join("\n")
exit 1
end

require "#{ENV['UNITY_DIR']}/auto/generate_test_runner"

test = ARGV[0]
runner = ARGV[1]
UnityTestRunnerGenerator.new.run(test, runner)
test_file = ARGV[0]
runner_file = ARGV[1] || test_file.sub(/\.c$/, '_Runner.c')
config_file = ARGV[2]

# if a config file is provided and exists, use it.
if config_file && File.exist?(config_file)
UnityTestRunnerGenerator.new(config_file).run(test_file, runner_file)
else
UnityTestRunnerGenerator.new.run(test_file, runner_file)
end
end