Skip to content

Commit

Permalink
when no arguments are given, print help properly
Browse files Browse the repository at this point in the history
  • Loading branch information
wwood committed Jul 9, 2012
1 parent 9a12dbb commit 7011d9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/kmer_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
:progressbar => true,
}

OptionParser.new do |opts|
o = OptionParser.new do |opts|
opts.banner = USAGE

opts.on("-w", "--window-size SIZE", "Length of the window to be used [default #{options[:window_size]}]") do |v|
Expand Down Expand Up @@ -92,7 +92,7 @@
opts.on("--trace options",String,"Set log level [default INFO]. e.g. '--trace debug' to set logging level to DEBUG") do | s |
Bio::Log::CLI.trace(s)
end
end.parse!
end; o.parse!
if ARGV.length != 1
$stderr.puts o
exit 1
Expand Down
7 changes: 7 additions & 0 deletions test/test_bio-kmer_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,11 @@ def script_path
end
end
end

should "print help when no arguments are given" do
command = "#{script_path}"
Open3.popen3(command) do |stdin, stdout, stderr|
assert stderr.readlines[0].match(/^Usage: kmer_counter/)
end
end
end

0 comments on commit 7011d9a

Please sign in to comment.