Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Fixed call with empty hash arg. (neilconway)

[git-p4: depot-paths = "//src/ruby2ruby/dev/": change = 7353]
  • Loading branch information...
commit 49147d0ba9981c18dcc38aed98675a7b4adb002e 1 parent c36f525
@zenspider zenspider authored
Showing with 8 additions and 0 deletions.
  1. +2 −0  lib/ruby2ruby.rb
  2. +6 −0 test/test_ruby2ruby.rb
View
2  lib/ruby2ruby.rb
@@ -208,12 +208,14 @@ def process_call(exp)
in_context :arglist do
until exp.empty? do
arg_type = exp.first.sexp_type
+ is_empty_hash = (exp.first == s(:hash))
arg = process exp.shift
next if arg.empty?
strip_hash = (arg_type == :hash and
not BINARY.include? name and
+ not is_empty_hash and
(exp.empty? or exp.first.sexp_type == :splat))
wrap_arg = Ruby2Ruby::ASSIGN_NODES.include? arg_type
View
6 test/test_ruby2ruby.rb
@@ -344,6 +344,12 @@ def test_rescue_block
util_compare inn, out
end
+ def test_call_empty_hash
+ inn = s(:call, nil, :foo, s(:arglist, s(:hash)))
+ out = "foo({ })"
+ util_compare inn, out
+ end
+
def util_compare sexp, expected_ruby, expected_eval = nil
assert_equal expected_ruby, @processor.process(sexp)
assert_equal expected_eval, eval(expected_ruby) if expected_eval
Please sign in to comment.
Something went wrong with that request. Please try again.