Permalink
Browse files

if no args & -v specified, exit with status 0

  • Loading branch information...
1 parent a044d7b commit 1a3da9f25fd9abea76c2aaf880e586d8834d5b09 @baroquebobcat baroquebobcat committed Jan 15, 2012
Showing with 7 additions and 1 deletion.
  1. +2 −1 lib/mirah/util/argument_processor.rb
  2. +5 −0 test/core/test_commands.rb
@@ -43,7 +43,7 @@ def process
Mirah::AST::Script.explicit_packages = true
when '--help', '-h'
print_help
- throw :exit
+ throw :exit, 0
when '--java', '-j'
if state.command == :compile
require 'mirah/jvm/compiler/java_source'
@@ -73,6 +73,7 @@ def process
when '--version', '-v'
args.shift
print_version
+ throw :exit, 0 if args.empty?
when '--no-save-extensions'
args.shift
state.save_extensions = false
@@ -54,6 +54,11 @@ def test_on_bad_argument_has_non_zero_exit_code
end
end
+ def test_on_v_with_no_args_exits_without_running_command
+ assert RaisesMirahErrorCommand.new(['-v']).execute
+ end
+
+
def test_on_j_option_when_command_is_not_compile_has_non_zero_exit_code
assert_non_zero_exit do
RaisesMirahErrorCommand.new(['-j']).execute

0 comments on commit 1a3da9f

Please sign in to comment.